re-evaluation



-----maxima-bounces at math.utexas.edu wrote: -----

>Hello.
>
>I'm new to maxima.

Great.

>My calculation has this result:
>
>''(%),numer;
>atan2([0.84147099018512],[0.44673372924494/sqr([0
>.82682180036742])^2])
>
>Now if I do ''(%),numer; again, I can't get the
>result to a single value.

Remove the square brackets and change sqr to sqrt
(sqrt = Maxima's square root function):

(%i3) atan2(0.84147099018512,0.44673372924494/sqrt(0.82682180036742)^2);
(%o3) 0.99999999887071

In Maxima, [a,b,...] represents a list. Thus in Maxima

(%i7) tan(42.0);
(%o7) 2.291387992437486
(%i8) tan([42.0]);
(%o8) tan([42.0])  <-- tangent of a list with one member

Oh...Maxima does have memoizing functions. To define
a memoizing  function, enclose the arguments with square
brackets:

(%i1) f[n] := (ldisplay(n), if n=0 then 1/2 else (n+1/2) * f[n-1]);
(%o1) f[n]:=(ldisplay(n),if n=0 then 1/2 else (n+1/2)*f[n-1])
(%i2) f[4];
(%t2) n=4
(%t3) n=3
(%t4) n=2
(%t5) n=1
(%t6) n=0
(%o6) 945/32

(%i7) f[4];   <-- side-effect of printing is skipped!
(%o7) 945/32

Barton