Opened 6 years ago
Last modified 4 months ago
#17469 new defect
Maxima doesn't do an integral we thought was fixed
Reported by: | kcrisman | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-6.5 |
Component: | calculus | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | Fixed upstream, but not in a stable release. | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
#11238 is back.
;;; Loading #P"/Users/.../sage/local/lib/ecl/sb-bsd-sockets.fas" ;;; Loading #P"/Users/.../sage/local/lib/ecl/sockets.fas" ;;; Loading #P"/Users/.../sage/local/lib/ecl/defsystem.fas" ;;; Loading #P"/Users/.../sage/local/lib/ecl/cmp.fas" Maxima 5.34.1 http://maxima.sourceforge.net using Lisp ECL 13.5.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)*(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); ^C Maxima encountered a Lisp error: Console interrupt. Automatically continuing.
Change History (8)
comment:1 Changed 6 years ago by
comment:2 Changed 6 years ago by
- Summary changed from Maxima hangs on an integral we thought was fixed to Maxima doesn't do an integral we thought was fixed
comment:3 Changed 6 years ago by
- Report Upstream changed from N/A to Reported upstream. No feedback yet.
comment:4 Changed 6 years ago by
Current doctest for this bites.
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
And the 'long time' is not kidding.
comment:5 Changed 6 years ago by
- Report Upstream changed from Reported upstream. No feedback yet. to Fixed upstream, but not in a stable release.
Apparently fixed again upstream, though still looooong time...
comment:6 Changed 3 years ago by
Sorry, wrong ticket (and I don't know how to delete a comment in Trac...)
comment:7 follow-up: ↓ 8 Changed 4 months ago by
Update: Sage v9.2 can evaluate the integral:
sage: integrate(exp(-x)*sin(sqrt(x)), x, 0, oo) 1/2*sqrt(pi)*e^(-1/4)
This is not the same answer as previously reported, because the previous calculation has e^(1/4)
, not e^(-1/4)
. However, Maple and Wolfram Alpha agree that there should be a minus sign, so probably this is good.
And the calculation is not ridiculously slow (from %timeit
on CoCalc
):
3.02 s ± 248 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
I was going to suggest closing this ticket as WorksForMe
, but then I noticed that the integration fails if we simply multiply the integrand by a constant:
sage: integrate(-exp(-x)*sin(sqrt(x)), x, 0, oo) -integrate(e^(-x)*sin(sqrt(x)), x, 0, +Infinity)
comment:8 in reply to: ↑ 7 Changed 4 months ago by
FMIW :
sage: var("a") a sage: f(x)=exp(-x)*sin(sqrt(x)) sage: integrate(f(x),[x,0,oo]) 1/2*sqrt(pi)*e^(-1/4) sage: integrate(f(x),[x,0,oo]).n() 0.690194223521571 sage: numerical_integral(f(x),0,oo) (0.6901942235198321, 1.3133617826621702e-07)
The minus sign seems correct...
sage: integrate(a*f(x),[x,0,oo]) a*integrate(e^(-x)*sin(sqrt(x)), x, 0, +Infinity)
Indeed... But :
sage: integrate(a*f(x),[x,0,oo]).unhold() 1/2*sqrt(pi)*a*e^(-1/4)
This might be more general...
Another quirk :
sage: integrate(a*f(x),[x,0,oo], algorithm="mathematica_free") 1/2*sqrt(pi)*a*e^(-1/4) sage: integrate(f(x),[x,0,oo], algorithm="mathematica_free") 0.690194000000000
Replying to gh-DaveWitteMorris:
Update: Sage v9.2 can evaluate the integral:
sage: integrate(exp(-x)*sin(sqrt(x)), x, 0, oo) 1/2*sqrt(pi)*e^(-1/4)This is not the same answer as previously reported, because the previous calculation has
e^(1/4)
, note^(-1/4)
. However, Maple and Wolfram Alpha agree that there should be a minus sign, so probably this is good.And the calculation is not ridiculously slow (from
%timeit
onCoCalc
):3.02 s ± 248 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)I was going to suggest closing this ticket as
WorksForMe
, but then I noticed that the integration fails if we simply multiply the integrand by a constant:sage: integrate(-exp(-x)*sin(sqrt(x)), x, 0, oo) -integrate(e^(-x)*sin(sqrt(x)), x, 0, +Infinity)
To be precise,
This did work in Sage 5.2.