Menu

#3376 lrats share package: fullratsubst doesn't catch infinite recursions

None
closed
nobody
8
2021-01-21
2017-12-31
No

Don't know if this is a bug: If an user gives maxima an endless task it can run out of ressources => am willing to accept a "won't fix" here. And I dont' have real problems with it => low prio. But in on (now deleted) example from the documentation I got the following:

(%i2)   load("lrats");
(%o2)   "/usr/share/maxima/5.41post/share/simplification/lrats.mac"
(%i3)   fullratsubst(b*a^2,a^2,a^3);
Message from maxima's stderr stream: INFO: Control stack guard page unprotected
Control stack guard page temporarily disabled: proceed with caution
Maxima encountered a Lisp error:
 Control stack exhausted (no more space for function call frames).
This is probably due to heavily nested or infinitely recursive function
calls, or a tail call that SBCL cannot or has not optimized away.
PROCEED WITH CAUTION.
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.

We can now decide to catch this case - or we can change the recursion to a loop making the function able to run many more recursions before running into problems. In wxMaxima I was surprised how much faster it got this way. Don't know if the same will be true in lisp; If we want to catch infinite recursions a starting point could be Robert's backtrace of the problem:

(%i3) load(lrats);
(%o3) "/usr/share/maxima/5.39.0/share/simplification/lrats.mac"
(%i4) trace (fullratsubst, fullratsubst1);
(%o4) [fullratsubst,fullratsubst1]
(%i5) fullratsubst (b*a^2, a^2, a^3);
1 Enter fullratsubst [a^2*b,a^2,a^3]
 1 Enter fullratsubst1 [a^2*b,a^2,a^3]
  2 Enter fullratsubst1 [a^2*b,a^2,a^3*b]
   3 Enter fullratsubst1 [a^2*b,a^2,a^3*b^2]
    4 Enter fullratsubst1 [a^2*b,a^2,a^3*b^3]
     5 Enter fullratsubst1 [a^2*b,a^2,a^3*b^4]
      6 Enter fullratsubst1 [a^2*b,a^2,a^3*b^5]
       7 Enter fullratsubst1 [a^2*b,a^2,a^3*b^6]
        8 Enter fullratsubst1 [a^2*b,a^2,a^3*b^7]
         9 Enter fullratsubst1 [a^2*b,a^2,a^3*b^8]
          10 Enter fullratsubst1 [a^2*b,a^2,a^3*b^9]
           11 Enter fullratsubst1 [a^2*b,a^2,a^3*b^10]
            12 Enter fullratsubst1 [a^2*b,a^2,a^3*b^11]
             13 Enter fullratsubst1 [a^2*b,a^2,a^3*b^12]
              14 Enter fullratsubst1 [a^2*b,a^2,a^3*b^13]
               15 Enter fullratsubst1 [a^2*b,a^2,a^3*b^14]
               16 Enter fullratsubst1 [a^2*b,a^2,a^3*b^15]
               17 Enter fullratsubst1 [a^2*b,a^2,a^3*b^16]
               18 Enter fullratsubst1 [a^2*b,a^2,a^3*b^17]

Discussion

  • Gunter Königsmann

    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,4 @@
    -Don't know if this is a bug => am willing to accept a "won't fix" here. And I dont' have real problems with it => low prio. But in on (now deleted) example from the documentation I got the following:
    +Don't know if this is a bug: If an user gives maxima an endless task it can run out of ressources => am willing to accept a "won't fix" here. And I dont' have real problems with it => low prio. But in on (now deleted) example from the documentation I got the following:
     ~~~
     (%i2)  load("lrats");
     (%o2)  "/usr/share/maxima/5.41post/share/simplification/lrats.mac"
    @@ -13,7 +13,7 @@
     Automatically continuing.
     To enable the Lisp debugger set *debugger-hook* to nil.
     ~~~
    -If we want to catch infinite recursions a starting point could be Robert's backtrace of the problem:
    +We can now decide to catch this case - or we can change the recursion to a loop making the function able to run many more recursions before running into problems. In wxMaxima I was surprised how much faster it got this way. Don't know if the same will be true in lisp; If we want to catch infinite recursions a starting point could be Robert's backtrace of the problem:
     ~~~
     (%i3) load(lrats);
     (%o3) "/usr/share/maxima/5.39.0/share/simplification/lrats.mac"
    
    • Priority: 5 --> 8
     
  • Leo Butler

    Leo Butler - 2021-01-21

    This is fixed in commit 864fd56e.

     
  • Leo Butler

    Leo Butler - 2021-01-21
    • labels: --> lrats, lratsubst, recur
    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB