#2384 Call stack overflow in evaluating a definite integral

open
nobody
5
2012-11-18
2012-03-23
Nils Bruin
No

Maxima 5.25.0 http://maxima.sourceforge.net
using Lisp SBCL 1.0.51-1.fc16
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) y: (x^2)*exp(x)/(1+exp(x))^2$
(%i2) integrate(y,x,-1000,1000);
[...]
Maxima encountered a Lisp error:

Control stack exhausted (no more space for function call frames).
[...]

This bug is reported to still be present in 5.26. Note that Maxima quite happily computes the indefinite integral:

(%i3) factor(diff(integrate(y,x),x)-y);
(%o3) 0

Discussion

  • Robert Dodier

    Robert Dodier - 2012-03-27

    Hmm, I can't confirm this. Maxima 5.26.0 + SBCL 1.0.45 + Ubuntu 11.04.

    I have seen problems caused by factoring terms like 1 + exp(n*x) where n is a large integer, but I'm not seeing a problem here.

    (%i1) display2d : false;

    (%o1) false
    (%i2) y: (x^2)*exp(x)/(1+exp(x))^2$

    (%i3) integrate(y,x,-1000,1000);

    (%o3) -((2000*%e^1000+2000)*log(%e^-1000*(%e^1000+1))
    +(-2*%e^1000-2)*li[2](-%e^-1000)+1000000)
    /(%e^1000+1)
    -((2000*%e^1000+2000)*log(%e^1000+1)+(2*%e^1000+2)*li[2](-%e^1000)
    -1000000*%e^1000)
    /(%e^1000+1)
    (%i4) build_info ();

    Maxima version: 5.26.0
    Maxima build date: 9:15 3/27/2012
    Host type: i686-pc-linux-gnu
    Lisp implementation type: SBCL
    Lisp implementation version: 1.0.45.0.debian

     
  • Nils Bruin

    Nils Bruin - 2012-03-27

    Thanks, Robert!

    Would you be able to check if bounds larger than 1000 are also good for you? For
    both my 5.25/SBCL and my 5.26/ECL I'm finding the cutoff is between 745 and 746.
    See below:

    Maxima 5.25.0 http://maxima.sourceforge.net
    using Lisp SBCL 1.0.51-1.fc16
    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) display2d : false;

    (%o1) false
    (%i2) y: (x^2)*exp(x)/(1+exp(x))^2$

    (%i3) integrate(y,x,-745,745);

    (%o3) -((1490*%e^745+1490)*log(%e^-745*(%e^745+1))
    +(-2*%e^745-2)*li[2](-%e^-745)+555025)
    /(%e^745+1)
    -((1490*%e^745+1490)*log(%e^745+1)+(2*%e^745+2)*li[2](-%e^745)
    -555025*%e^745)
    /(%e^745+1)
    (%i4) build_info ();

    Maxima version: 5.25.0
    Maxima build date: 18:46 8/22/2011
    Host type: x86_64-redhat-linux-gnu
    Lisp implementation type: SBCL
    Lisp implementation version: 1.0.51-1.fc16
    -------------------------------------------------------------------------------
    Maxima 5.26.0 http://maxima.sourceforge.net
    using Lisp ECL 11.1.1
    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) display2d : false;

    (%o1) false
    (%i2) y: (x^2)*exp(x)/(1+exp(x))^2$

    (%i3) integrate(y,x,-745,745);

    (%o3) -((1490*%e^745+1490)*log(%e^-745*(%e^745+1))
    +(-2*%e^745-2)*li[2](-%e^-745)+555025)
    /(%e^745+1)
    -((1490*%e^745+1490)*log(%e^745+1)+(2*%e^745+2)*li[2](-%e^745)-555025*%e^745)
    /(%e^745+1)
    (%i4) build_info ();

    %% this is much slower than SBCL, though. Perhaps some tail call that SBCL
    %% optimizes away and is left in place in ECL?
    -------------------------------------------------------------------------------
    Maxima 5.26.0 http://maxima.sourceforge.net
    using Lisp ECL 11.1.1
    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) display2d : false;

    (%o1) false
    (%i2) y: (x^2)*exp(x)/(1+exp(x))^2$

    (%i3) integrate(y,x,-746,746);

    Condition of type: STACK-OVERFLOW
    BINDING-STACK overflow at size 8448. Stack can probably be resized.

    %% resizing the stack doesn't solve a problem and eventually runs out of
    %% resources
    -------------------------------------------------------------------------------
    Maxima 5.25.0 http://maxima.sourceforge.net
    using Lisp SBCL 1.0.51-1.fc16
    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) display2d : false;

    (%o1) false
    (%i2) y: (x^2)*exp(x)/(1+exp(x))^2$

    (%i3) integrate(y,x,-746,746);
    INFO: Control stack guard page unprotected
    Control stack guard page temporarily disabled: proceed with caution

    %% and then it hangs ...

     
  • Michael Orlitzky

    Hmm, I'm still seeing this on 5.27/ECL:

    (%i1) display2d: false;

    (%o1) false
    (%i2) f: (x^2)*%e^x/(1+%e^x)^2;

    (%o2) x^2*%e^x/(%e^x+1)^2
    (%i3) integrate(f, x, -1000, 1000);

    Maxima encountered a Lisp error:

    BINDING-STACK overflow at size 8448. Stack can probably be resized.

    Automatically continuing.
    To enable the Lisp debugger set *debugger-hook* to nil.
    Maxima encountered a Lisp error:

    Detected access to an invalid or protected memory address.

    Automatically continuing.
    To enable the Lisp debugger set *debugger-hook* to nil.
    (%i4) build_info();

    (%o4) ?%build_info("5.27.0","2012-04-14 12:45:56","x86_64-pc-linux-gnu","ECL",
    "12.2.1")

     

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

Sign up for the SourceForge newsletter:





No, thanks