# Ticket #11445(closed defect: fixed)

Opened 2 years ago

## symbolic integration fails on a very simple test case

Reported by: Owned by: pdehaye burcin major sage-5.0 calculus integrate kcrisman Fixed upstream, in a later stable release. Karl-Dieter Crisman Michael Orlitzky sage-5.0.beta11

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

## Change History

### comment:1 Changed 2 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 2 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 2 years ago by kcrisman

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

fixed over there

### comment:5 Changed 2 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 2 years ago by kcrisman

• Priority changed from critical to major

### Changed 14 months ago by mjo

Doctest for the correct result.

### comment:7 Changed 14 months ago by mjo

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

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

### comment:8 Changed 14 months ago by kcrisman

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

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 14 months 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 14 months 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 14 months ago by jdemeyer

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