Yes, I have already done this and it works fine. Maybe this is not exactly what you had in mind but here is a workbook for Hydrogen
atoms.
(%i1) declare(k, integer, z, integer);
(out1) done
(%i2) declare(m, integer, l, integer);
(out2) done
(%i3) P[k](x):=1/(2^k*k!)*diff((x^2-1)^k, x, k);
(out3) P[k](x):=1/(2^k*k!)*diff((x^2-1)^k,x,k)
(%i4) Legendre[k, m](x):=(-1)^abs(m)*(1-x^2)^(abs(m)/2)*diff(P[k](x), x, abs(m));
(out4) Legendre[k,m](x):=(-1)^abs(m)*(1-x^2)^(abs(m)/2)*diff(P[k](x),x,abs(m))
(%i5) Y[k, m](%theta, %alpha):=if m<0 then Y[k, -m](%theta, %alpha) else
(-1)^m*sqrt((2*k+1)*(k-m)!/(4*%pi*(k+m)!))*%e^(%i*m*%alpha)*Legendre[k,m](cos(%theta));
(out5) Y[k,m](%theta,%alpha):=if m<0 then Y[k,-m](%theta,%alpha) else
(-1)^m*sqrt(((2*k+1)*(k-m)!)/(4*%pi*(k+m)!))*%e^(%i*m*%alpha)*Legendre[k,m](cos(%theta))
(%i6) Laguerre[p, z](x):=(-1)^p*diff(LaguerreP[z+p](x), x, p);
(out6) Laguerre[p,z](x):=(-1)^p*diff(LaguerreP[z+p](x),x,p)
(%i7) LaguerreP[q](x):=%e^x*diff(%e^(-x)*x^q, x, q);
(out7) LaguerreP[q](x):=%e^x*diff(%e^(-x)*x^q,x,q)
(%i8) %Psi[n, l, m](%theta, %alpha, r):=sqrt((2/(n*a))^3*(n-l-1)!/(2*n*((n+l)!)^3))*%e^(-r/(n*a))*(2*r/(n*a))^l*Laguerre[2*l+1,
n-l-1](2*r/(n*a))*Y[l, m](%theta, %alpha);
(out8)
%Psi[n,l,m](%theta,%alpha,r):=sqrt(((2/(n*a))^3*(n-l-1)!)/(2*n*(n+l)!^3))*%e^((-r)/(n*a))*((2*r)/(n*a))^l*Laguerre[2*l+1,n-l-1]((2*r)/(n*a))*Y[l,m](%theta,%alpha)
(%i9) assume(a>0);
(out9) [a>0]
(%i10) assume(%epsilon[0]>0, mass>0, hbar>0, e>0) ;
(out10) [%epsilon[0]>0,mass>0,hbar>0,e>0]
Here is where I use the stuff I setup above.
(%i11) factor(%Psi[5,3,2](%theta, %alpha, r)*%Psi[5,3,2](%theta, -%alpha, r)),nouns;
(out11) ((cos(%theta)-1)^2*cos(%theta)^2*(cos(%theta)+1)^2*r^6*(r-20*a)^2*%e^(-(2*r)/(5*a)))/(2929687500*%pi*a^11)
Rich
----- Original Message -----
From: "Edwin Woollett" <woollett at charter.net>
To: "maxima mailing list" <maxima at math.utexas.edu>
Sent: Sunday, August 09, 2009 3:12 PM
Subject: recursive def of legendre polynomial
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