Opened 9 years ago

Closed 8 years ago

# failing calculation of a symbolic integral

Reported by: Owned by: casamayou burcin major sage-5.0 calculus integrate zimmerma, kcrisman sage-5.0.beta12 Michael Orlitzky Karl-Dieter Crisman Fixed upstream, in a later stable release. #11445

### Description

With a symbolic calculation, Sage returns 0 for the integral integrate(exp(-x)*sinh(sqrt(x)), x, 0, oo) instead of exp(1/4) * sqrt(pi) / 2

```sage: integrate(exp(-x)*sinh(sqrt(x)), x, 0, oo)
0
sage: integral_numerical(exp(-x)*sinh(sqrt(x)), 0, oo)
(1.1379378972322944, 3.1822014179283542e-07)
sage: (exp(1/4) * sqrt(pi) / 2).n()
1.13793789723437
sage: plot(exp(-t)*sinh(sqrt(t)), t, 0, 10)
```

### comment:1 Changed 9 years ago by kcrisman

• Report Upstream changed from N/A to Reported upstream. Little or no feedback.

This is also present in the latest Maxima. This is now reported at this Maxima bug artifact.

```Maxima 5.24.0 http://maxima.sourceforge.net
using Lisp SBCL 1.0.24
(%i3) integrate(exp(-x)*sinh(sqrt(x)),x,0,inf);
(%o3) 0
(%o4) [1.137937897234377, 5.171862937913829e-11, 345, 0]
```

### comment:2 Changed 8 years ago by kcrisman

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

This is NOT fixed in 5.24, so we can't yet do it, but it is now fixed in Maxima 5.26.

```(%i2) display2d:false;

(%o2) false
(%i3) integrate(exp(-x)*sinh(sqrt(x)),x,0,inf);

(%o3) %e^(1/4)*sqrt(%pi)/2
```

### Changed 8 years ago by mjo

Add a doctest for the non-zero result.

### comment:3 Changed 8 years ago by mjo

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

Here's another one I found fixed by the Maxima upgrade. The patch will apply cleanly on top of #11445. I put the test in the same place as that one, but I could of course copy/paste them out together.

### comment:4 Changed 8 years ago by kcrisman

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

Looks good. No worries about the cut/paste. However, let's try to put others in the symbolic integration ones... Maybe we should even separate some of them out into one of our "tests" files in calculus/ or something.

### comment:5 Changed 8 years ago by jdemeyer

• Merged in set to sage-5.0.beta12
• Resolution set to fixed
• Status changed from positive_review to closed

### comment:6 Changed 8 years ago by mjo

This seems to be back with maxima-5.27.0, but only with `domain: complex;`

```Maxima 5.27.0 http://maxima.sourceforge.net
using Lisp ECL 12.2.1
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) display2d:false;

(%o1) false
(%i2) integrate(exp(-x)*sinh(sqrt(x)),x,0,inf);

(%o2) %e^(1/4)*sqrt(%pi)/2
(%i3) domain:complex;

(%o3) complex
(%i4) integrate(exp(-x)*sinh(sqrt(x)),x,0,inf);

(%o4) 0
```

Reported upstream at https://sourceforge.net/tracker/?func=detail&aid=3529144&group_id=4933&atid=104933.

### comment:7 Changed 8 years ago by zimmerma

thank you Michael, the new doctest will bump when/if we upgrade to Maxima 5.27.

Paul

### comment:8 Changed 7 years ago by mjo

This is fixed upstream, again. It should make it into maxima-5.28.

### comment:9 Changed 5 years ago by kcrisman

I won't reopen this one, but it is definitely still there - to the point that I don't see how we can be passing doctests!

```(%i1) display2d:false;

(%o1) false
(%i2) integrate(exp(-x)*sinh(sqrt(x)),x,0,inf);

(%o2) -%e^(1/4)*(2*gamma_incomplete(1,1)-gamma_incomplete(1/2,1)-sqrt(%pi)-2)/4
+%e^(1/4)*gamma_incomplete(1,1)/2-%e^(1/4)*gamma_incomplete(1/2,1)/4
+%e^(1/4)*sqrt(%pi)/4-%e^(1/4)/2
(%i3) domain:complex;

(%o3) complex
(%i4) integrate(exp(-x)*sinh(sqrt(x)),x,0,inf);
<hangs>
```

See #17469. Weirdly, the doctest does pass, but we had to change things at some point, which is a regression on Maxima's part:

```    Another symbolic integral, from :trac:`11238`, that used to return
zero incorrectly; with Maxima 5.26.0 one gets
``1/2*sqrt(pi)*e^(1/4)``, whereas with 5.29.1, and even more so
with 5.33.0, the expression is less pleasant, but still has the
same value.  Unfortunately, the computation takes a very long time
with the default settings, so we temporarily use the Maxima
setting ``domain: real``::

sage: sage.calculus.calculus.maxima('domain: real')
real
sage: f = exp(-x) * sinh(sqrt(x))
sage: t = integrate(f, x, 0, Infinity); t            # long time
1/4*sqrt(pi)*(erf(1) - 1)*e^(1/4) - 1/4*(sqrt(pi)*(erf(1) - 1) - sqrt(pi) + 2*e^(-1) - 2)*e^(1/4) + 1/4*sqrt(pi)*e^(1/4) - 1/2*e^(1/4) + 1/2*e^(-3/4)
sage: t.simplify_exp()  # long time
1/2*sqrt(pi)*e^(1/4)
sage: sage.calculus.calculus.maxima('domain: complex')
complex
```

### comment:10 Changed 5 years ago by zimmerma

with 6.0 both work but take a long time:

```sage: sage.calculus.calculus.maxima('domain: real')
real
sage: integrate(exp(-x)*sinh(sqrt(x)), x, 0, oo)
1/4*sqrt(pi)*(erf(1) - 1)*e^(1/4) - 1/4*(sqrt(pi)*(erf(1) - 1) - sqrt(pi) + 2*e^(-1) - 2)*e^(1/4) + 1/4*sqrt(pi)*e^(1/4) - 1/2*e^(1/4) + 1/2*e^(-3/4)
sage: sage.calculus.calculus.maxima('domain: complex')
complex
sage: integrate(exp(-x)*sinh(sqrt(x)), x, 0, oo)
1/4*(sqrt(pi)*(erf(1) - 1) + sqrt(pi) + 2*e^(-1) - 2)*e^(1/4) - 1/4*(sqrt(pi)*(erf(1) - 1) - sqrt(pi) + 2*e^(-1) - 2)*e^(1/4)
```

Paul

Note: See TracTickets for help on using tickets.