Menu

#3079 integrate(sin(x)/x,x,-1,1) gives wrong answer

None
pending
nobody
integrate (157)
5
2019-07-27
2016-01-24
No

Maxima's answer is wrong:

(%i1) integrate(sin(x)/x,x,-1,1);
(%o1) %i*gamma_incomplete(0,-%i)-%i*gamma_incomplete(0,%i)
(%i2) expand(%),numer;
(%o2) -1.249426512855427

No way this can be negative!
The right answer would be about 1.89217.

Also, from 0 to 1 it can't be done at all:

(%i3) integrate(sin(x)/x,x,0,1);
(%o3) integrate(sin(x)/x,x,0,1)

I think what's going on is the following: Maxima's antiderivative for sin(x)/x is -(%i*gamma_incomplete(0,%i*x)-%i*gamma_incomplete(0,-%i*x))/2 instead of expintegral_si(x). The former antiderivative has a discontinuity at x=0, which Maxima doesn't notice, and so it just plugs the limits into the antiderivative, which leads to a wrong result.

https://dl.dropboxusercontent.com/u/845597/discontinuity.png

Related

Bugs: #3649

Discussion

  • Jaime E. Villate

    See also the discussion in bug report #2941 (https://sourceforge.net/p/maxima/bugs/2941/)

     
  • David Scherfgen

    David Scherfgen - 2016-01-26

    I think the problem here is that Maxima just plugs the integration bounds into the antiderivative without checking for discontinuities in it. Or maybe it does check, but doesn't see the discontinuity at x=0?

     
  • David Scherfgen

    David Scherfgen - 2016-01-26

    In fact, tracing the function discontinuities-in-interval reveals that it returns no for the antiderivative. So Maxima thinks it's OK to do just F(b)-F(a).

     
  • David Scherfgen

    David Scherfgen - 2016-01-27

    I have changed the discontinuities-in-interval function to look for discontinuities in gamma_incomplete as well. This makes Maxima return a noun form for integrate(sin(x)/x,x,-1,1), which is better than a wrong answer. But we can do better by converting Maxima's antiderivative into expintegral_si(x), which is continuous and therefore great for definite integration. I will implement this.

     
  • David Scherfgen

    David Scherfgen - 2016-01-27
    • status: open --> pending
     
    • John Scott

      John Scott - 2019-07-27

      Has there been any progress on this? It is affecting SageMath also

       

Log in to post a comment.

MongoDB Logo MongoDB