-- www.eigenmath.org/quantum-harmonic-oscillator-1.txt -- Verify quantum harmonic oscillator wave functions. Hhat(psi) = simplify( -hbar^2/(2 m) d(psi,x,2) + 1/2 m omega^2 x^2 psi ) E(n) = hbar omega (n + 1/2) psi(n) = (m omega/(pi hbar))^(1/4) exp(-m omega x^2/(2 hbar)) * 1/sqrt(2^n n!) H(n,sqrt(m omega/hbar) x) H(n,z) = test( n < 0,0, n = 0,1, 2 z H(n - 1,z) - 2 (n - 1) H(n - 2,z) ) psi0 = psi(0) psi1 = psi(1) psi2 = psi(2) psi3 = psi(3) -- print wave functions psi0 psi1 psi2 psi3 "check Schrodinger equation (1 = ok)" Hhat(psi0) == E(0) psi0 Hhat(psi1) == E(1) psi1 Hhat(psi2) == E(2) psi2 Hhat(psi3) == E(3) psi3 "check raising operator (1 = ok)" a1(psi) = sqrt(hbar/(2 m omega)) (m omega/hbar x psi - d(psi,x)) psi1 == 1/sqrt(1) a1(psi0) psi2 == 1/sqrt(2) a1(psi1) psi3 == 1/sqrt(3) a1(psi2) "check lowering operator (1 = ok)" a(psi) = sqrt(hbar/(2 m omega)) (m omega/hbar x psi + d(psi,x)) psi0 == 1/sqrt(1) a(psi1) psi1 == 1/sqrt(2) a(psi2) psi2 == 1/sqrt(3) a(psi3) "check normalization (1.0 = ok)" -- arbitrary values needed for numerical integration m = 0.5 hbar = 1.0 omega = 1.5 I(f,x,a,b) = 1/10 sum(k,10a,10b - 1,float(eval(f,x,k/10))) I(psi0^2,x,-10,10) -- integrate from -10 to 10 I(psi1^2,x,-10,10) I(psi2^2,x,-10,10) I(psi3^2,x,-10,10)