#1187 Maxima asks unnecessary questions in integration

closed
nobody
5
2007-06-27
2007-05-07
No

Following example shows Maxima asking a lot of questions, although the result doesn't depend on the answers; I consider that a bug.

This is from the mailing list 2007-04-13, "integration asks to many questions".

(%i1) p:(1+a*cos(kp*x1)+a*cos(kp*x2)+a*a*cos(kp*x1)*cos(kp*x2))*sin(kp*(x1-x2)/4);
(%i2) p2:p*(1+c*cos(kp*(x1+x2)/2));
(%i3) integrate(integrate(p2^2,x1,-4*%pi/kp,4*%pi/kp),x2,5*%pi/kp/2,7*%
pi/kp/2);

Is kp positive or negative?
p;
Is a zero or nonzero?
n;
Is a c positive, negative, or zero?
n;
Is c zero or nonzero?
n;
Is a positive or negative?
n;
Is c positive or negative?
p;
Is cos(kp x2) positive, negative, or zero?
p;
Is kp positive or negative?
p;

<result here>

Discussion

  • Nobody/Anonymous

    Logged In: NO

    I had the same silly question when integrating
    exp(ïky)*hermite(n,x)*x^j

     
  • Raymond Toy

    Raymond Toy - 2007-06-13

    Logged In: YES
    user_id=28849
    Originator: NO

    FWIW, the maxima is computing this integral via method-radical-poly. It can find the antiderivative and is now carefully substituting the limits in via intsubs. Since the antiderivative only involves trig functions (no inverses), there shouldn't be a problem just substituting in the limits.

    Perhaps easy-subs needs to be extended to handle this case?

     
  • Raymond Toy

    Raymond Toy - 2007-06-13

    Logged In: YES
    user_id=28849
    Originator: NO

    Here is a replacement for easy-subs. If the antiderivative doesn't involve the inverse of a trig function, or hyperbolic function or isn't a log, we can substitute in the limits directly (if they're finite). If the limit succeeds, we are done.

    This change gets rid of all the questions and doesn't introduce any additional issues in the testsuite.

    The change is the new line containing involve.

    (defun easy-subs (e ll ul)
    (cond ((or (infinityp ll) (infinityp ul))
    ())
    (t
    (cond ((or (polyinx e var ())
    (not (involve e '(%log %asin %acos %atan %asinh %acosh %atanh))))
    (let ((ll-val (no-err-sub ll e))
    (ul-val (no-err-sub ul e)))
    (cond ((and ll-val ul-val)
    (m- ul-val ll-val))
    (t ()))))
    (t ())))))

     
  • Raymond Toy

    Raymond Toy - 2007-06-13

    Logged In: YES
    user_id=28849
    Originator: NO

    Oops. There is one difference. Problem 209 in rtest15 returns 2/3/sqrt(2) instead of sqrt(2)/3. But these are equivalent.

     
  • Raymond Toy

    Raymond Toy - 2007-06-27

    Logged In: YES
    user_id=28849
    Originator: NO

    A slightly different version of easy-subs has been checked in. Problem 209 in rtest15 passes.

    Closing this report.

     
  • Raymond Toy

    Raymond Toy - 2007-06-27
    • status: open --> closed
     

Log in to post a comment.

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

Sign up for the SourceForge newsletter:





No, thanks