#2786 defint fails to detect divergent integral, and returns different results

None
open
nobody
5
2014-08-25
2014-07-21
dan hayes
No

wxMaxima version: 13.4.0
Maxima version: 5.31.1
Maxima build date: 2013-09-24 09:49:12
Host type: i686-pc-mingw32
Lisp implementation type: GNU Common Lisp (GCL)
Lisp implementation version: GCL 2.6.8

(assume(k>0,r>0),display2d:false,ldisp([integrate(r*demoivre(integrate(exp(%i*k*r*w),w,-1,1)),r,0,inf)
,integrate(r*ratsimp(demoivre(integrate(exp(%i*k*r*w),w,-1,1))),r,0,inf)]));

gives

[2*'integrate(sin(k*r),r,0,inf),     2*('integrate(sin(k*r),r,0,inf))/k]

Both expressions should have k in denominator but the first one, without using ratsimp, DOES NOT
- perhaps you can see this easier in the usual fancy display output without using
' display2d:false '

Discussion

  • Robert Dodier
    Robert Dodier
    2014-08-25

    enclose code in four tildes before and after

     
  • Robert Dodier
    Robert Dodier
    2014-08-25

    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -5,8 +5,10 @@
     Lisp implementation type: GNU Common Lisp (GCL)
     Lisp implementation version: GCL 2.6.8
    
    +~~~~
     (assume(k>0,r>0),display2d:false,ldisp([integrate(r*demoivre(integrate(exp(%i*k*r*w),w,-1,1)),r,0,inf)
     ,integrate(r*ratsimp(demoivre(integrate(exp(%i*k*r*w),w,-1,1))),r,0,inf)])); gives [2*'integrate(sin(k*r),r,0,inf),     2*('integrate(sin(k*r),r,0,inf))/k]
    +~~~~
    
     Both expressions should have k in denominator but the first one, without using ratsimp, DOES NOT
     - perhaps you can see this easier in the usual fancy display output without using
    
     
  • Robert Dodier
    Robert Dodier
    2014-08-25

    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -7,7 +7,13 @@
    

    (assume(k>0,r>0),display2d:false,ldisp([integrate(rdemoivre(integrate(exp(%ikrw),w,-1,1)),r,0,inf)
    -,integrate(rratsimp(demoivre(integrate(exp(%ikrw),w,-1,1))),r,0,inf)]
    )); gives [2'integrate(sin(kr),r,0,inf), 2('integrate(sin(kr),r,0,inf))/k]
    +,integrate(rratsimp(demoivre(integrate(exp(%ikrw),w,-1,1))),r,0,inf)]));
    +~~~~
    +
    +gives
    +
    +~~~~
    +[2'integrate(sin(kr),r,0,inf), 2('integrate(sin(kr),r,0,inf))/k]

    Both expressions should have k in denominator but the first one, without using ratsimp, DOES NOT

     
  • Robert Dodier
    Robert Dodier
    2014-08-25

    2nd attempt to format

     
  • Robert Dodier
    Robert Dodier
    2014-08-25

    • labels: --> defint, integrate
    • summary: problem with ratsimp or some other bug ? --> defint fails to detect divergent integral, and returns different results
     
  • Robert Dodier
    Robert Dodier
    2014-08-25

    I've revised the title to reflect what I've figured out.

    (1) defint (definite integral) returns 2 different results, depending on form of integrand (either with or without ratsimp). That's a bug.

    (2) defint doesn't notice that the integral is divergent. This is a missed opportunity; it should be easy to determine that the integral is divergent.

    I've simplified the bug a little bit:

    (%i2) foo : r*(%i*(cos(k*r)-%i*sin(k*r))/(k*r)-%i*(%i*sin(k*r)+cos(k*r))/(k*r)) $
    (%i3) defint (foo, r, 0, inf);
    (%o3) 2*'integrate(sin(k*r),r,0,inf)
    (%i4) defint (ratsimp (foo), r, 0, inf);
    (%o4) 2*('integrate(sin(k*r),r,0,inf))/k
    

    If defint can't figure out that the integral is divergent, it should return %o4 (with factor 1/k in result).

     
  • Robert Dodier
    Robert Dodier
    2014-08-25

    By the way, the indefinite integral, with or without ratsimp, is correct.

    (%i6) integrate (foo, r);
    (%o6) -2*cos(k*r)/k^2
    (%i7) integrate (ratsimp (foo), r);
    (%o7) -2*cos(k*r)/k^2