-- quantum-electric-field-1.txt -- (1,0,0,0) = |n - 3/2> -- (0,1,0,0) = |n - 1/2> -- (0,0,1,0) = |n + 1/2> -- (0,0,0,1) = |n + 3/2> A = exp(-i (n - 1/2) omega t) B = exp(-i (n + 1/2) omega t) psiA = A (0,1,0,0) psiB = B (0,0,1,0) psi = psiA + psiB U = ((0, sqrt(n - 1), 0, 0), (0, 0, sqrt(n), 0), (0, 0, 0, sqrt(n + 1)), (0, 0, 0, 0)) a(psi) = dot(U,psi) a1(psi) = dot(transpose(U),psi) "Verify lowering operator (1=ok)" a((0,1,0,0)) == sqrt(n - 1) (1,0,0,0) a((0,0,1,0)) == sqrt(n + 0) (0,1,0,0) a((0,0,0,1)) == sqrt(n + 1) (0,0,1,0) "Verify raising operator" a1((1,0,0,0)) == sqrt(n - 1) (0,1,0,0) a1((0,1,0,0)) == sqrt(n + 0) (0,0,1,0) a1((0,0,1,0)) == sqrt(n + 1) (0,0,0,1) C = sqrt(hbar omega/(2 epsilon0)) exp(i k z) Ehat(psi) = C a(psi) + conj(C) a1(psi) "Compute E" E = dot(conj(psi),Ehat(psi)) E "Verify E" E == sqrt(2 n hbar omega/epsilon0) expcos(k z - omega t) "Verify Hamiltonian operator" H(psi) = 1/2 hbar omega (a1(a(psi)) + a(a1(psi))) H(psiA) == hbar omega (n - 1/2) psiA H(psiB) == hbar omega (n + 1/2) psiB