Edwin Woollett wrote:
> Can I use either ordinary functions or hashed arrays
> to define recursively the legendre polynomial p(n,x)
> defined by
>
> p (n,x) := ((2*n-1)/n)*x*p (n-1,x) - ((n-1)/n)*p (n-2,x),
>
> p (0,x) : 1,
> p (1,x) : x,
>
> so I get, eg., p (2,x) --> - 1/2 + 3*x^2/ 2 .
>
> Thanks in advance,
>
> Ted Woollett
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
I suggest you use the hashed array syntax
(p[n](x) := ((2*n-1)/n)*x*p [n-1](x) - ((n-1)/n)*p [n-2](x),
p [0](x) := 1,
p [1](x) := x)
so you can look at p[3], p[3](z^2), etc.
you might also want to do p[3](rat(w));
a recursive version is not nearly as much fun. it would look like p(n,x):= if n=0 then 1 else if n=1 then x else ...
RJF