[Maxima] little recursion yields stack-overflow

Barton Willis willisb at unk.edu
Wed May 20 07:59:12 CDT 2009


Using Maxima + GCL , it's too easy to run into such problems; a simple
example:

 (%i1) f(k) := if k = 0 then 1 else f(k-1) + 1/k$

OK:

 (%i2) f(100);
 (%o2)
 17255451288708850246802870400516623589983/2788815009188499086581352357412492142272

Not OK:

 (%i4) f(250);
Maxima encountered a Lisp error:

Compiling f allows f(250) to return a number; Maxima + Clozure CL computes
f(1500) without compiling, but not f(3000).

Barton



More information about the Maxima mailing list