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

failing calculation of a symbolic integral #11238

Closed
sagetrac-casamayou mannequin opened this issue Apr 22, 2011 · 16 comments
Closed

failing calculation of a symbolic integral #11238

sagetrac-casamayou mannequin opened this issue Apr 22, 2011 · 16 comments

Comments

@sagetrac-casamayou
Copy link
Mannequin

sagetrac-casamayou mannequin commented Apr 22, 2011

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)

Depends on #11445

Upstream: Fixed upstream, in a later stable release.

CC: @zimmermann6 @kcrisman

Component: calculus

Keywords: integrate

Author: Michael Orlitzky

Reviewer: Karl-Dieter Crisman

Merged: sage-5.0.beta12

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

@sagetrac-casamayou sagetrac-casamayou mannequin added this to the sage-5.0 milestone Apr 22, 2011
@kcrisman
Copy link
Member

comment:1

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
(%i4) quad_qagi(exp(-x)*sinh(sqrt(x)),x,0,inf);
(%o4) [1.137937897234377, 5.171862937913829e-11, 345, 0]

@kcrisman
Copy link
Member

Upstream: Reported upstream. Little or no feedback.

@kcrisman
Copy link
Member

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

@kcrisman
Copy link
Member

comment:2

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

@orlitzky
Copy link
Contributor

Add a doctest for the non-zero result.

@orlitzky
Copy link
Contributor

comment:3

Attachment: sage-trac_11238.patch.gz

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.

@orlitzky
Copy link
Contributor

Author: Michael Orlitzky

@kcrisman
Copy link
Member

Dependencies: #11445

@kcrisman
Copy link
Member

comment:4

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.

@kcrisman
Copy link
Member

Reviewer: Karl-Dieter Crisman

@jdemeyer
Copy link

jdemeyer commented Apr 2, 2012

Merged: sage-5.0.beta12

@orlitzky
Copy link
Contributor

comment:6

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

@zimmermann6
Copy link

comment:7

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

Paul

@orlitzky
Copy link
Contributor

comment:8

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

@kcrisman
Copy link
Member

kcrisman commented Dec 8, 2014

comment:9

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

@zimmermann6
Copy link

comment:10

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

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

5 participants