One way to obtain the allowed energies of a potential well numerically is to turn the Schrödinger equation into a matrix equation, by discretizing the variable x. Slice the relevant interval at evenly spaced points {xj}, with xj+1−xj≡Δx, and let ψj≡ψ(xj) (likewise Vj≡V(xj)). Then
dxdψ≈Δxψj+1−ψj,dx2d2ψ≈(Δx)2ψj+1−2ψj+ψj−1.(2.195)
(The approximation presumably improves as Δx decreases.) The discretized Schrödinger equation reads
−2mℏ2((Δx)2ψj+1−2ψj+ψj−1)+Vjψj=Eψj,(2.196)
or
−λψj+1+(2λ+Vj)ψj−λψj−1=Eψj,where λ≡2m(Δx)2ℏ2.(2.197)
In matrix form,
HΨ=EΨ(2.198)
where (letting vj≡Vj/λ)
H≡λ⋱−100(2+vj−1)−10−1(2+vj)−10−1(2+vj+1)00−1⋱(2.199)
and
Ψ≡⋮ψj−1ψjψj+1⋮(2.200)
(what goes in the upper left and lower right corners of H depends on the boundary conditions, as we shall see). Evidently the allowed energies are the eigenvalues of the matrix H (or would be, in the limit Δx→0).
Apply this method to the infinite square well. Chop the interval (0≤x≤a) into N+1 equal segments (so that Δx=a/(N+1)), letting x0≡0 and xN+1≡a. The boundary conditions fix ψ0=ψN+1=0, leaving
Ψ≡ψ1⋮ψN.(2.201)
(a) Construct the N×N matrix H, for N=1, N=2, and N=3. (Make sure you are correctly representing Equation 2.197 for the special cases j=1 and j=N.)
(b) Find the eigenvalues of H for these three cases "by hand," and compare them with the exact allowed energies (Equation 2.30).
(c) Using a computer (Mathematica's Eigenvalues package will do it) find the five lowest eigenvalues numerically for N=10 and N=100, and compare the exact energies.
(d) Plot (by hand) the eigenvectors for N=1, 2, and 3, and (by computer, Eigenvectors) the first three eigenvectors for N=10 and N=100.