Menu

#3519 integrate(abs(sin(x)),x,0,2*%pi); gives wring result

None
closed
nobody
5
2021-11-14
2019-01-14
No

After loading the abs_integrate package, integrate(abs(sin(x)),x,0,2*%pi); gives the (wrong) result 0:

(%i2) load(abs_integrate);
(%o2) /usr/share/maxima/5.42.1/share/contrib/integration/abs_integrate.mac
(%i3) integrate(abs(sin(x)),x,0,2*%pi);
(%o3)                                  0

Similar to https://sourceforge.net/p/maxima/bugs/2144/, it seems to have reappeared in 5.42. Found out when trying to update maxima in Sagemath.

Discussion

  • Petr Lobaz

    Petr Lobaz - 2019-02-01

    Mostly the same applies in this case (no abs_integrate package):
    (%i1) integrate(sqrt(1-cos(x)^2), x, 0, %pi/2);
    (%o1) -1

    Indeed, the equivalent formula gives the correct result:
    (%i2) integrate(sin(x), x, 0, %pi/2);
    (%o2) 1

    The bug is present in Maxima 5.42.2, 5.42.1, 5.41.0a (at least).

    wxMaxima version: 19.01.2x
    using wxWidgets version: wxWidgets 3.1.0
    Maxima version: 5.42.2
    Maxima build date: 2019-01-25 00:03:20
    Host type: x86_64-w64-mingw32
    System type:
    gcc -mno-cygwin -g -O2 -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit -Wreturn-type -Wmissing-declarations -Wno-sign-compare -Wno-format-nonliteral -O2 -fexpensive-optimizations -falign-functions=4 -D_WIN32 -DENABLE_UNICODE -I/usr/local/include -DDYNAMIC_FFI -I. -L/usr/local/lib -lintl /usr/local/lib/libreadline.dll.a -L/usr/local/lib -ltermcap /usr/local/lib/libavcall.a /usr/local/lib/libcallback.a -luser32 -lws2_32 -lole32 -loleaut32 -luuid -liconv -L/usr/local/lib -lsigsegv libgnu_cl.a
    SAFETY=0 HEAPCODES STANDARD_HEAPCODES GENERATIONAL_GC SPVW_BLOCKS SPVW_MIXED TRIVIALMAP_MEMORY
    libsigsegv 2.8
    libiconv 1.13
    libreadline 6.0 GNU C 3.4.5 (mingw-vista special r3) PC/386
    Lisp implementation type: CLISP
    Lisp implementation version: 2.49 (2010-07-07) (built on toshiba [192.168.43.206])
    wxMaxima's idea of the directory layout is:
    User configuration dir: C:\Users\Petr Lobaz/maxima/
    Help dir: C:\maxima-5.42.2\wxMaxima/help
    Maxima lisp dir: C:\maxima-5.42.2\bin/../share/maxima/5.42.2

     
  • Robert Dodier

    Robert Dodier - 2020-12-23
    • labels: --> integrate, abs_integrate, defint
     
  • Barton Willis

    Barton Willis - 2021-06-11

    First the good news: The function extra_integrate (defined in abs_integrate), gives an antiderivative of abs(sin(x)) that is valid on the entire real line.

    Second, the bad: some other integration method is tried before extra_integrate is called with abs(sin(x)). That gives an antiderivative that isn't wrong, but it's not valid on[0, 2 pi ].

    (%i2)   extra_integrate(abs(sin(x)),x);
    (%o2)   2*floor(x/%pi)-cos(x)*cos(%pi*floor(x/%pi))
    
     
  • Barton Willis

    Barton Willis - 2021-11-14
    • status: open --> closed
     
  • Barton Willis

    Barton Willis - 2021-11-14

    Fixed by Commit [3ca423] . Appended regression test. Closing ticket.

     

    Related

    Commit: [3ca423]


Log in to post a comment.