#1519 integrate((x+1)^2.0,x) loops endlessly


Maxima can integrate expressions like (x+1)^n where n is an integer or a floating point representation of an integer, e.g. integrate((x+1)^8.0,x).

But this does not work for the floating point numbers 2.0, 3.0, ..., 5.0 as an exponent. Maxima loops endlessly.

The reason is the following code in DIFFDIV (the bug is marked):

(cond ((and (mexptp exp)
(mplusp (cadr exp))
(integerp2 (caddr exp)) ; here the bug
(< (caddr exp) 6)
(> (caddr exp) 0))
(return (integrator (expandexpt (cadr exp) (caddr exp)) var))))

The function INTEGERP2 checks for an integer or an floating point representation of an integer. If the value is between 0 and 6 the expression is expanded with the function EXPANDEXPT and the integrator is called again.

But this does not work with a floating point representation of an integer, because for this case the expression is not expanded by the function EXPANDEXPT. The integrator gets again the same expression and loops endlessly.

To possible corrections:

1. Convert the floating point exponent to an integer
and then call EXPANDEXPT.

2. Do not test for a floating point respresentation and
change INTEGERP2 to INTEGERP. Now for a floating
point exponent betweeen 0.0 and 6.0 the result is
given in the form (1/n)*(x+1)^(n+1) where 1/n and
(n+1) are floating point numbers.

I think solution 2 is better, because we get the results with the expected floating point numbers.

Dieter Kaiser


  • Dan Gildea

    Dan Gildea - 2008-11-18

    Applied solution 2 in sin.lisp rev 1.33.

  • Dan Gildea

    Dan Gildea - 2008-11-18
    • status: open --> closed
    • assigned_to: nobody --> dgildea

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks