Menu

#2314 Two different results for an integral

None
closed
nobody
5
2016-12-14
2011-11-27
Ripley
No

Hello,

By integrating sqrt(4*x^2-y^2) into the triangle {0<x<1; 0<y<x} in two
diffferent order:
integrate( integrate( sqrt(4*x^2-y^2), x , y, 1), y , 0,1)
Integrate( integrate( sqrt(4*x^2-y^2), y, 0, x), x, 0,1)

WxMaxime give two different results. Where is the mistake?

Discussion

  • Rupert Swarbrick

    With a recent version of the sources, I get the following:

    Maxima 5.25post http://maxima.sourceforge.net
    using Lisp SBCL 1.0.53.0.debian
    Distributed under the GNU Public License. See the file COPYING.
    Dedicated to the memory of William Schelter.
    The function bug_report() provides bug reporting information.
    (%i1) expr: sqrt(4*x^2-y^2);
    2 2
    (%o1) sqrt(4 x - y )
    (%i2) integrate(integrate(expr, x, y, 1), y, 0, 1);
    Is y - 1 positive, negative, or zero?

    n;
    Is y positive or negative?

    pos;
    3 log(4 sqrt(3) + 8) + 4 %pi - 1
    (%o2) --------------------------------
    18
    (%i3) integrate(integrate(expr, x, 0, x), x, 0, 1);
    Is x positive, negative, or zero?

    pos;
    Is y positive or negative?

    pos;

    rat: replaced -1.e-8 by -1/100000000 = -1.e-8
    <snip lots more rat warnings: eugh.>

    Is y positive or negative?

    pos;
    1
    / 2 2 2 2
    [ y log(4 sqrt(4 x - y ) + 8 x) y log(4 %i y)
    (%o3) I (- ------------------------------- + --------------
    ] 4 4
    /
    0
    2 2
    x sqrt(4 x - y )
    + -----------------) dx
    2

    This, while unhelpful isn't wrong. Can you post a transcript of what
    you actually do and get (use maxima from the command line,
    maybe). Definitely include the version of Maxima that you're using.

    Rupert

     
  • Rupert Swarbrick

    Drat. I didn't realise that sourceforge would eat the text formatting. If it isn't clear, the first time I get an answer with logs and sqrts. The second time, I get a more complicated integrate noun form.

     
  • Ripley

    Ripley - 2011-11-28

    Thank you rswarbrick but you mistaked the input line ( % i3)... You wrote
    Integrate(integrate(expr, x,0, x), x,0,1) instead of
    Integrate(integrate(expr, y, 0, x) ,x ,0,1)

     
  • jcvtrip

    jcvtrip - 2011-11-28

    Hello,

    Here you have a transcript...

    Maxima version: 5.25.1
    Maxima build date: 9:14 9/5/2011
    Host type: i686-apple-darwin10.8.0
    Lisp implementation type: SBCL
    Lisp implementation version: 1.0.47

    expres:sqrt(4*x^2-y^2);
    (%o5) sqrt(4*x^2-y^2)

    integrate(integrate(expres, x,y,1),y,0,1);
    "Is "y-1" positive, negative, or zero?"n;
    "Is "y" positive or negative?"p;

    (%o6) (3*log(4*sqrt(3)+8)+4*%pi-1)/18

    ev(%o6,numer);
    (%o12) 1.093118188249627

    integrate(integrate(expres, y, 0,x),x,0,1);
    "Is "x" positive, negative, or zero?"p;

    (%o10) (2*%pi+3^(3/2))/18

    ev(%o10,numer);
    (%o13) .6377409849936787

     
  • jcvtrip

    jcvtrip - 2011-11-30

    Please, some help on this question?

    Any comment would be helpful...

     
  • Raymond Toy

    Raymond Toy - 2011-11-30

    I have looked very briefly at this. The intermediate indefinite integrals look right, and maxima says the derivative simplifies to the integrand, so I don't really know what's wrong.

    I think the thing to do is to examine whether the indefinite integrals are actually correct. There could be a problem with choosing the wrong branch since one of the integrals involves inverse trig functions.

     
  • Ripley

    Ripley - 2011-12-08

    I couldn't realize that is simply a mistake... So, should I assume Maxima integrator subroutines aren't trustworthy?

    I like Maxima but it is not admissible for me to work with a not trusty "scientific" software...

    Could someone give a hand to have any reference to how Maxima manage integrals internally? I am going to do my best to find the bug...

     
  • Raymond Toy

    Raymond Toy - 2011-12-09

    You should always check your work. Commercial systems have bugs too.

    The definite integration routines are in src/defint.lisp. References are included therein along with some description of the individual algorithms. If you're going to debug the code, you'll need to know lisp.

    If you can even find out that one of the definite or indefinite integrals is wrong would be a great help.

    Thanks for your help

     
  • Kris Katterjohn

    Kris Katterjohn - 2016-12-14
    • summary: Tío different results for an integral --> Two different results for an integral
    • status: open --> closed
    • Group: --> None
     
  • Kris Katterjohn

    Kris Katterjohn - 2016-12-14

    I'm closing this ticket since this was fixed at some point prior to v5.28. Now the integrals give the same result:

    (%i1) assume (0 < x, x < 1, 0 < y, y < 1)$
    
    (%i2) integrate (integrate (sqrt (4*x^2 - y^2), x, y, 1), y, 0, 1);
    (%o2) (2*sqrt(3)*%pi+9)/(2*3^(5/2))
    
    (%i3) integrate (integrate (sqrt (4*x^2 - y^2), y, 0, x), x, 0, 1);
    (%o3) (2*%pi+3^(3/2))/18
    
    (%i4) ratsimp (%o3 - %o2);
    (%o4) 0
    

    This result agrees with the result from dblint and Wolfram Alpha.

    I added tests for this in commit [35c625].

     

    Related

    Commit: [35c625]


Log in to post a comment.