Wrong result for definite integral of sin(x)*exp(I*x)

76 views
Skip to first unread message

Jeremie Knuesel

unread,
Apr 15, 2018, 11:35:22 AM4/15/18
to sage-devel
Hi,

integrate(sin(x)*exp(I*x),x,-pi,0) returns 3/2*I*pi instead of 1/2*I*pi

Is this a known issue? I couldn't find it reported elsewhere.

Best regards,

Jeremie Knuesel

Eric Gourgoulhon

unread,
Apr 15, 2018, 12:44:23 PM4/15/18
to sage-devel
Hi,

Indeed, this seems a bug in Sage.
Note that both SymPy and Giac return the correct answer:

sage: integrate(sin(x)*exp(I*x), x, -pi, 0)
3/2*I*pi
sage: integrate(sin(x)*exp(I*x), x, -pi, 0, algorithm='sympy')
1/2*I*pi
sage: integrate(sin(x)*exp(I*x), x, -pi, 0, algorithm='giac')
1/2*I*pi

Eric.

Ralf Stephan

unread,
Apr 16, 2018, 1:31:36 AM4/16/18
to sage-devel
Not Sage, it's Maxima:
(%i2) integrate(sin(x)*exp(%i*x),x,-%pi,0);      
                               log
(- 1)
(%o2)                          -------- + %i %pi
                                 
2

Martin R

unread,
Apr 16, 2018, 1:54:02 AM4/16/18
to sage-devel
FriCAS also would get it right, except that there is a bug in the interface, see https://trac.sagemath.org/ticket/25174

If someone can give me a hint on how to send %i instead of I for the imaginary unit to fricas, I'll fix it...

(1) -> integrate(sin(x)*exp(%i*x),x=-%pi..0)

        %i %pi
   (1)  ------
           2

but

sage: integrate(sin(x)*exp(I*x),x,-pi,0,algorithm="fricas")
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)

because

sage: fricas.integrate(sin(x)*exp(I*x), x)
    I x                 I x
I %e   sin(x) - cos(x)%e
---------------------------
            2
           I  + 1

Martin

rjf

unread,
Apr 20, 2018, 8:10:08 PM4/20/18
to sage-devel
If Sage calls Maxima, then it is a bug in Sage also.
Interestingly, Maxima gets the INdefinite integral correct.
Reply all
Reply to author
Forward
0 new messages