Subject: stack overflow with recursive definitions (crash)
From: Gilles Schintgen
Date: Sat, 26 Nov 2005 15:56:06 +0100
Hi,
Just for fun, I tried doing some numeric experiments with a recursively
defined sequence:
(%i1) u[0]: bfloat(1)$
(%i2) u[n]:= bfloat((3*u[n-1]+1)^(1/3)-1)$
Unfortunately I'm always getting stack overflow errors when trying large
values of n:
(%i3) u[10];
(%o3) 1.038217430642616B-1
(%i4) u[200];
Maxima encountered a Lisp error:
Error in PROGN [or a callee]: Bind stack overflow.
Automatically continuing.
To reenable the Lisp debugger set *debugger-hook* to nil.
(%i5) u[100]; u[150]; u[200];
(%o5) 1.019321545887242B-2
(%o6) 6.764441490234863B-3
(%o7) 5.059738684726922B-3
Notice that this problem doesn't arise if I'm evaluating the sequence in
smaller increments.
I guess this is a Lisp limitation. When compiling maxima (5.9.2) with clisp
instead of gcl, this limit is increased. But then maxima crashes with a
segfault if I ask it to compute u[2000].
Is it possible to increase the "bind stack"?
Or, alternatively, is it possible to give a different recursive definition,
that is, one which avoids these stack problems?
Should I file a bug report for the crash?
Any comments are welcome.
Regards,
Gilles