Menu

#3017 "integrate_use_rootsof" leads to wrong result

None
closed
nobody
5
2015-09-14
2015-09-08
No

We want to integrate 1/(x^(1/3)+x+1), which integrate cannot handle. With integrate_use_rootsof enabled, we get the following result:

(%i1) integrate(1/(x^(1/3)+x+1),x),integrate_use_rootsof:true;
(%o1) 3*'lsum((%r1^2*log(x^(1/3)-%r1))/(3*%r1^2+1),%r1,rootsof(x+x^(1/3)+1))

Note that the argument of rootsof is not a polynomial, but the denominator of the original integrand. This doesn't make sense. The correct argument to rootsof would be x^3+x+1, which is the denominator of the integrand after substituting u=x^(1/3):

(%i1) integrate(1/(x^(1/3)+x+1),x);
(%o1) 'integrate(1/(x+x^(1/3)+1),x)
(%i2) changevar(%,u=x^(1/3),u,x);
Is u positive, negative or zero?positive;
(%o2) 3*'integrate(u^2/(u^3+u+1),u)
(%i3) ev(%,nouns),integrate_use_rootsof:true;
(%o3) 3*'lsum((%r1^2*log(u-%r1))/(3*%r1^2+1),%r1,rootsof(u^3+u+1))

What seems to happen here is that Maxima performs the substitution u=x^(1/3), just like in the above transcript, but then, for the argument of rootsof, does the back-substitution, which is wrong.

Without the back-substitution, we would get exactly the same result as Wolfram Alpha:
http://www.wolframalpha.com/input/?i=integrate+1%2F%28x%5E%281%2F3%29%2Bx%2B1%29+dx

Comparison:

Discussion

  • David Scherfgen

    David Scherfgen - 2015-09-08

    Proposed fix: We need an additional auxiliary variable to be used within rootsof, otherwise if the original variable of integration is chosen, it will be affected by back-substitution, and the result will be wrong.

    src/sinint.lisp, line 169:

    - (($rootsof) ,qq))))
    + (($rootsof) ,(subst (make-param) variable qq)))))
    

    This now works properly:

    (%i1) integrate(1/(x^(1/3)+x+1),x),integrate_use_rootsof:true;
    (%o1) 3*'lsum((%r1^2*log(x^(1/3)-%r1))/(1+3*%r1^2),%r1,rootsof(%r2^3+%r2+1))
    
     

    Last edit: David Scherfgen 2015-09-08
  • David Scherfgen

    David Scherfgen - 2015-09-09

    Well, actually we don't need a new variable. The dummy variable (%r1 above) will do as well, so:

    - (($rootsof) ,qq))))
    + (($rootsof) ,(subst dummy variable qq)))))
    

    Result:

    (%i1) integrate(1/(x^(1/3)+x+1),x),integrate_use_rootsof:true;
    (%o1) 3*'lsum((%r1^2*log(x^(1/3)-%r1))/(1+3*%r1^2),%r1,rootsof(%r1^3+%r1+1))
    
     
  • David Scherfgen

    David Scherfgen - 2015-09-14
    • status: open --> closed
     
  • David Scherfgen

    David Scherfgen - 2015-09-14

    Fixed by commit 1249f37195155cacfd4aefd41a611ed0b08f1fc2.

     

Log in to post a comment.