Opened 9 years ago

Closed 8 years ago

#11445 closed defect (fixed)

symbolic integration fails on a very simple test case

Reported by: pdehaye Owned by: burcin
Priority: major Milestone: sage-5.0
Component: calculus Keywords: integrate
Cc: kcrisman Merged in: sage-5.0.beta11
Authors: Michael Orlitzky Reviewers: Karl-Dieter Crisman
Report Upstream: Fixed upstream, in a later stable release. Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

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...

Attachments (1)

sage-trac_11445.patch (844 bytes) - added by mjo 8 years ago.
Doctest for the correct result.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 9 years ago by kcrisman

  • Cc kcrisman added
  • Report Upstream changed from N/A to Not yet reported upstream; Will do shortly.

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.

comment:2 Changed 9 years ago by pdehaye

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

comment:3 Changed 9 years ago by kcrisman

  • Report Upstream changed from Not yet reported upstream; Will do shortly. to Reported upstream. Little or no feedback.

comment:4 Changed 9 years ago by pdehaye

fixed over there

comment:5 Changed 9 years ago by pdehaye

  • Report Upstream changed from Reported upstream. Little or no feedback. to Fixed upstream, in a later stable release.

comment:6 Changed 9 years ago by kcrisman

  • Priority changed from critical to major

Changed 8 years ago by mjo

Doctest for the correct result.

comment:7 Changed 8 years ago by mjo

  • Authors set to Michael Orlitzky
  • Status changed from new to needs_review

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

comment:8 Changed 8 years ago by kcrisman

  • Reviewers set to Karl-Dieter Crisman
  • Status changed from needs_review to positive_review

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.

comment:9 Changed 8 years ago by mjo

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.

comment:10 Changed 8 years ago by kcrisman

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.

comment:11 Changed 8 years ago by jdemeyer

  • Merged in set to sage-5.0.beta11
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.