Skip to content

Commit

Permalink
Trac #12947: Bug in integrating x*cos(x^3)
Browse files Browse the repository at this point in the history
From this [https://groups.google.com/forum/?fromgroups#!topic/sage-
support/-Dzaion3VrA sage-support thread]:
{{{
sage: numerical_integral(x*cos(x^3),0,.5)
(0.1247560409610376, 1.3850702913602309e-15)
sage: integrate(x*cos(x^3),(x,0,1/2)).n()
-0.0677842754623305
}}}
Given
{{{
sage: integrate(x*cos(x^3),x)
1/12*((-I*sqrt(3) - 1)*gamma(2/3, -I*x^3) + (I*sqrt(3) - 1)*gamma(2/3,
I*x^3))*(x^3)^(1/3)/x
sage: integrate(x*cos(x^3),(x,0,1/2))
-1/3*gamma(2/3) + 1/6*gamma(2/3, -1/8*I) + 1/6*gamma(2/3, 1/8*I)
}}}
this is probably something where Maxima is returning too many imaginary
things and something isn't cancelling right either there or in Sage
proper?  We've had trouble with either side of this with incomplete
gamma functions before.

URL: http://trac.sagemath.org/12947
Reported by: kcrisman
Ticket author(s): Peter Bruin
Reviewer(s): Ralf Stephan
  • Loading branch information
Release Manager authored and vbraun committed Jul 18, 2014
2 parents 300ac3a + 72706eb commit dc8130a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/sage/interfaces/maxima_lib.py
Expand Up @@ -742,7 +742,7 @@ def sr_integral(self,*args):
4
This definite integral returned zero (incorrectly) in at least
maxima-5.23. The correct answer is now given (:trac:`11591`)::
Maxima 5.23. The correct answer is now given (:trac:`11591`)::
sage: f = (x^2)*exp(x) / (1+exp(x))^2
sage: integrate(f, (x, -infinity, infinity))
Expand All @@ -766,6 +766,15 @@ def sr_integral(self,*args):
sage: maxima('radexpand: true')
true
The following integral was computed incorrectly in versions of
Maxima before 5.27 (see :trac:`12947`)::
sage: a = integrate(x*cos(x^3),(x,0,1/2)).n()
sage: a.real()
0.124756040961038
sage: a.imag().abs() < 3e-17
True
"""
try:
return max_to_sr(maxima_eval(([max_integrate],[sr_to_max(SR(a)) for a in args])))
Expand Down

0 comments on commit dc8130a

Please sign in to comment.