Menu

#2936 stack overflow in integrate

None
closed
nobody
5
2015-04-15
2015-04-14
No

Maxima 5.36.0 + Clisp. I don't have a smaller example. EDIT: smaller example in comment below.

(%i1) foo : exp(-(log(x) - MU)*(log(x) - MU)/(2*SIGMA*SIGMA))/(x*SIGMA*sqrt(2*%pi)) $
(%i2) bar : (log(B) - log(x*SIGMA) + ((x-A)*(x-A)/(2*B*B) - (log(x) -MU)*(log(x) -MU)/(2*SIGMA*SIGMA))) $
(%i3) assume (SIGMA>0, x>A, B>0) $
(%i4) foobar : expand (foo*bar) $
(%i5) integrate (foobar, x, A, inf);
Is A positive, negative or zero?

p;
Is A - 1 positive, negative or zero?

p;
     MU
Is %e   - A positive, negative or zero?

p;

*** - Program stack overflow. RESET

A stack trace obtained with SBCL seems to show (among others) SIMP-GAMMA-INCOMPLETE, MEQP, ZEROP1, and SRATSIMP on the call stack. Not sure who called whom.

Discussion

  • Robert Dodier

    Robert Dodier - 2015-04-14
    • labels: integrate, defint --> integrate, defint, gamma
     
  • Robert Dodier

    Robert Dodier - 2015-04-15

    Simpler:

    integrate (%e^((-log(x)^2)-1)*log(x),x);
    trigsimp (%);
    

    triggers the stack overflow.

    In the original example, integrate calls DINTLOG calls ANTIDERIV and then INTSUBS calls trigsimp on the antiderivative.

    trigsimp ((%i*gamma_incomplete(1,(1-2*log(x))^2/4)*(1-2*log(x))^2)
               /(2*log(x)-1)^2);
    

    is enough to cause a stack overflow.

    Even just

    trigsimp (gamma_incomplete(1,log(x)));
    

    is enough.

     
  • Robert Dodier

    Robert Dodier - 2015-04-15
    • labels: integrate, defint, gamma --> integrate, defint, trigsimp, gamma_incomplete, log
     
  • Robert Dodier

    Robert Dodier - 2015-04-15
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,4 @@
    -Maxima 5.36.0 + Clisp. I don't have a smaller example.
    +Maxima 5.36.0 + Clisp. I don't have a smaller example. EDIT: smaller example in comment below.
    
     ~~~~
     (%i1) foo : exp(-(log(x) - MU)*(log(x) - MU)/(2*SIGMA*SIGMA))/(x*SIGMA*sqrt(2*%pi)) $
    
     
  • Robert Dodier

    Robert Dodier - 2015-04-15
    • status: open --> closed
     
  • Robert Dodier

    Robert Dodier - 2015-04-15

    Problem was caused by trigsimp formal argument x appearing in input expression. Renaming x to x% works around it; lexical scope is a better solution. Fixed by commit [1780b2f], Closing this report.

     

Log in to post a comment.

MongoDB Logo MongoDB