Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

symbolic integration fails on a very simple test case #11445

Closed
pdehaye mannequin opened this issue Jun 7, 2011 · 15 comments
Closed

symbolic integration fails on a very simple test case #11445

pdehaye mannequin opened this issue Jun 7, 2011 · 15 comments

Comments

@pdehaye
Copy link
Mannequin

pdehaye mannequin commented Jun 7, 2011

The following happens

sage: var("x")
x
sage: integrate(abs(x - 1) + abs(x + 1) - 2*abs(x), (x,-Infinity,Infinity))
0
sage: integrate(abs(x - 1) + abs(x + 1) - 2*abs(x),(x,-Infinity,10))
2

The second answer is the correct one, of course...

Upstream: Fixed upstream, in a later stable release.

CC: @kcrisman

Component: calculus

Keywords: integrate

Author: Michael Orlitzky

Reviewer: Karl-Dieter Crisman

Merged: sage-5.0.beta11

Issue created by migration from https://trac.sagemath.org/ticket/11445

@pdehaye pdehaye mannequin added this to the sage-5.0 milestone Jun 7, 2011
@pdehaye pdehaye mannequin added c: calculus labels Jun 7, 2011
@pdehaye pdehaye mannequin assigned burcin Jun 7, 2011
@kcrisman
Copy link
Member

kcrisman commented Jun 7, 2011

comment:1

This also happens in Maxima.


Maxima 5.24.0 http://maxima.sourceforge.net
using Lisp SBCL 1.0.24
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) integrate(abs(x - 1) + abs(x + 1) - 2*abs(x),x,minf,10);
(%o1)                                  2
(%i2) integrate(abs(x - 1) + abs(x + 1) - 2*abs(x),x,minf,inf);
(%o2)                                  0

I don't know that I would call this "very simple", though, as integrating absolute value things is somewhat tricky when done symbolically.

@kcrisman
Copy link
Member

kcrisman commented Jun 7, 2011

Upstream: Not yet reported upstream; Will do shortly.

@pdehaye
Copy link
Mannequin Author

pdehaye mannequin commented Jun 7, 2011

comment:2

sure, but certainly something i would hope works! also not sure how much of it is due to the infinite interval and how much due to the function itself

@kcrisman
Copy link
Member

kcrisman commented Jun 8, 2011

comment:3

This is now reported at this location.

@kcrisman
Copy link
Member

kcrisman commented Jun 8, 2011

Changed upstream from Not yet reported upstream; Will do shortly. to Reported upstream. Little or no feedback.

@pdehaye
Copy link
Mannequin Author

pdehaye mannequin commented Jun 13, 2011

comment:4

fixed over there

@pdehaye
Copy link
Mannequin Author

pdehaye mannequin commented Jun 13, 2011

Changed upstream from Reported upstream. Little or no feedback. to Fixed upstream, in a later stable release.

@orlitzky
Copy link
Contributor

Doctest for the correct result.

@orlitzky
Copy link
Contributor

Author: Michael Orlitzky

@orlitzky
Copy link
Contributor

comment:7

Attachment: sage-trac_11445.patch.gz

Fixed now that we've got Maxima 5.26.0. Here's a doctest.

@kcrisman
Copy link
Member

Reviewer: Karl-Dieter Crisman

@kcrisman
Copy link
Member

comment:8

I probably would have put it in sage.symbolic.integration.integral.integral somewhere, where there are lots of tests, but I guess this is fine, and otherwise all is well. I'd hate to have you rebase it to that other location, seems a waste... but then again, that's where they are...

Or what do you think? The problem is that we have no canonical location for integral stuff. integrate? is a wasteland, though it points to better sources of doc.

@orlitzky
Copy link
Contributor

comment:9

I honestly went through the same thought process. At first, I thought, "I'll put it with the Maxima stuff because it was a Maxima bug." But then I thought, what if we ever drop Maxima completely? This isn't a Maxima test: this tests that our integration works. Whatever we would replace Maxima with should also pass this test!

Then, I had to decide whether to put it in functional.py or under symbolics. I settled on this because it's what gets called first when the user calls integrate(). It's also where you're sent if you look up the code with integrate? or integrate??, so to stay true to the report on the ticket, I put it there.

If the reporter had done,

f = abs(x - 1) + abs(x + 1) - 2*abs(x)
f.integral(...)

I probably would have stuck it in symbolics. It's no big deal to move it, in any case.

@kcrisman
Copy link
Member

comment:10

Well, you'll notice that I did give positive review. You are right about the integration tests not belonging in the Maxima docs, of course.

@jdemeyer
Copy link

Merged: sage-5.0.beta11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants