Menu

#4213 integrate(sin(x)/x,-X,X) limit as X--> infinity is wrong

None
open
nobody
5
2023-12-30
2023-11-17
ZOO
No

This is from comment: https://sourceforge.net/p/maxima/mailman/message/51782153/
One can check this against other CAS systems with sage:
sage: integrate(sin(x)/x, x,-M,M,algorithm='maxima').limit(M=infinity)
0
sage: integrate(sin(x)/x, x,-M,M,algorithm='giac').limit(M=infinity)
pi
sage: integrate(sin(x)/x, x,-M,M,algorithm='fricas').limit(M=infinity)
pi

Discussion

  • Robert Dodier

    Robert Dodier - 2023-11-24
    • labels: --> integrate, limit, defint
     
  • Robert Dodier

    Robert Dodier - 2023-11-24

    For the record, the equivalent Maxima-specific formulation is

    integrate (sin(x)/x, x, -M, M);
    limit (%, x, M, inf);
    

    Not clear to me where the error is entering the picture, whether integrate is calling the limit code and the error is in limit, or if integrate is getting mixed up on its own.

    integrate has trouble with related problems if 0 is in the interval of integration, but it seems to be okay if 0 is excluded, e.g.

    assume (M1 > 0);
    foo: integrate (sin(x)/x, x, M1, inf);
    ev (foo, M1 = 1/100, numer, expand);
    

    seems okay (it's approximately pi/2) but

    limit (foo, M1, 0, plus);
    

    provokes "unfamiliar singularity".

     
  • Barton Willis

    Barton Willis - 2023-12-30

    Incidentally:

    OK:

    (%i1)   integrate(sin(x)/x,x,minf,inf);
    (%o1)   %pi
    

    OK:

    (%i2)   defint(sin(x)/x,x,minf,inf);
    (%o2)   %pi
    

    Not OK:

    (%i3)   ldefint(sin(x)/x,x,minf,inf);
    (%o3)   0
    

    A better antiderivative for integrate(sin(x)/x,x,-M,M) is expintegral_si(M) - expintegral_si(-M). And

    (%i26)  limit(expintegral_si(M) - expintegral_si(-M),M,inf);
    (%o26)  %pi
    
     
  • Raymond Toy

    Raymond Toy - 2023-12-30

    I think that antiderivative is better than the one we return today which involves gamma_incomplete(0,%i*x). The occurrence of %i is kind of messy looking.

     
  • Barton Willis

    Barton Willis - 2023-12-30

    Yes, it's messy, but it is also discontinuous at zero. And that gives rise to the bug.

    I think that the source of this less than ideal antiderivative is the case M2-EXP-TYPE-2 in the function integrate-exp-special (defined in sin.lisp). Actually, the integrand has been exponentialized before arriving at integrate-exp-special, so maybe this needs to be patched before entering integrate-exp-special?

    (%i2)   :lisp(trace  integrate-exp-special m2-exp-type-2);
    (INTEGRATE-EXP-SPECIAL M2-EXP-TYPE-2)
    (%i2)   integrate(sin(x)/x,x);
      0: (MAXIMA::INTEGRATE-EXP-SPECIAL ((MAXIMA::MTIMES MAXIMA::SIMP) ((MAXIMA::MEXPT MAXIMA::SIMP) MAXIMA::$X -1) ((MAXIMA::MEXPT MAXIMA::SIMP) MAXIMA::$%E ((MAXIMA::MTIMES MAXIMA::SIMP) -1 MAXIMA::$%I MAXIMA::$X))) MAXIMA::$X)
        1: (MAXIMA::M2-EXP-TYPE-2 ((MAXIMA::MTIMES) ((MAXIMA::MEXPT) MAXIMA::$%E ((MAXIMA::MTIMES MAXIMA::SIMP) -1 MAXIMA::$%I MAXIMA::$X)) ((MAXIMA::MEXPT) MAXIMA::$X -1)))
        1: M2-EXP-TYPE-2 returned
             ((B (MTIMES SIMP) -1 $%I) (R . 1) (Z . $X) (D . 0) (A . $%E) (V . -1)
              (Z . $X))
      0: INTEGRATE-EXP-SPECIAL returned
           ((MTIMES SIMP) -1 ((%GAMMA_INCOMPLETE SIMP) 0 ((MTIMES SIMP) $%I $X)))
      0: (MAXIMA::INTEGRATE-EXP-SPECIAL ((MAXIMA::MTIMES MAXIMA::SIMP) ((MAXIMA::MEXPT MAXIMA::SIMP) MAXIMA::$X -1) ((MAXIMA::MEXPT MAXIMA::SIMP) MAXIMA::$%E ((MAXIMA::MTIMES MAXIMA::SIMP MAXIMA::RATSIMP) MAXIMA::$%I MAXIMA::$X))) MAXIMA::$X)
        1: (MAXIMA::M2-EXP-TYPE-2 ((MAXIMA::MTIMES) ((MAXIMA::MEXPT) MAXIMA::$%E ((MAXIMA::MTIMES MAXIMA::SIMP) MAXIMA::$%I MAXIMA::$X)) ((MAXIMA::MEXPT) MAXIMA::$X -1)))
        1: M2-EXP-TYPE-2 returned
             ((B . $%I) (R . 1) (Z . $X) (D . 0) (A . $%E) (V . -1) (Z . $X))
      0: INTEGRATE-EXP-SPECIAL returned
           ((MTIMES SIMP) -1 ((%GAMMA_INCOMPLETE SIMP) 0 ((MTIMES SIMP) -1 $%I $X)))
    (%o2)   -((%i*gamma_incomplete(0,%i*x)-%i*gamma_incomplete(0,-(%i*x)))/2)
    
     

Log in to post a comment.