stack overflow with recursive definitions (crash)



The Maxima notation

        xxx[nnn] := formula

defines an array xxx through a formula.  Maxima saves any calculated values
of the array when they are calculated for future use.  This is very useful
for recursive definitions, especially doubly recursive definitions such as
the naive definition of the Fibonacci sequence

        f[0]:1 $ f[1]:1 $
        f[i]:=f[i-1]+f[i-2] $

This would take exponential time to calculate if it were written as a normal
recursive function.

Even in your case, this memo'izing (as it's called) could be useful if you
were calculating using very high precision bfloats.

Otherwise, you can use the normal recursive function definition.

Another approach is to calculate yuour u[i]'s from the bottom up.  That is,
if you're interested in u[2000], first write

       for i thru 2000 do u[i]$

This calculates and stores the values of u[i] without displaying them.

                -s