-- psi returns a hydrogen atom eigenfunction psi(n,l,m) = R(n,l) Y(l,m) -- R returns a radial eigenfunction R(n,l) = 2 / n^2 * a0^(-3/2) * sqrt((n - l - 1)! / (n + l)!) * (2 r / (n a0))^l * L(2 r / (n a0),n - l - 1,2 l + 1) * exp(-r / (n a0)) L(x,n,m) = (n + m)! sum(k,0,n,(-x)^k / ((n - k)! (m + k)! k!)) e = quote(e) -- clear symbol e a0 = 4 pi epsilon0 hbar^2 / (e^2 mu) -- Y returns a spherical harmonic eigenfunction Y(l,m) = (-1)^m sqrt((2l + 1) / (4 pi) (l - m)! / (l + m)!) * P(expcos(theta),l,m) exp(i m phi) P(f,n,m) = eval(1 / (2^n n!) (1 - x^2)^(m/2) * d((x^2 - 1)^n,x,n + m),x,f) -- H is the Hamiltonian H(psi) = -hbar^2 Lap(psi) / (2 mu) - e^2 / (4 pi epsilon0 r) psi Lap(f) = 1/r^2 d(r^2 d(f,r),r) + 1/(r^2 expsin(theta)) d(expsin(theta) d(f,theta),theta) + 1/(r expsin(theta))^2 d(f,phi,2) -- E returns the energy eigenvalue E(n) = -mu / (2 n^2) (e^2 / (4 pi epsilon0 hbar))^2 -- S checks the Schrodinger equation S(n,l,m) = H(psi(n,l,m)) == E(n) psi(n,l,m) "Verify hydrogen atom eigenfunctions (1=ok)" S(1,0,0) S(2,0,0) S(2,1,0) S(2,1,1) S(2,1,-1) S(3,0,0) S(3,1,0) S(3,1,1) S(3,1,-1) S(3,2,0) S(3,2,1) S(3,2,2) S(3,2,-1) S(3,2,-2)
Run