Schrödinger's equation is integrated numerically for the first three energy states for the quartic oscillator. The integration algorithm is taken from J. C. Hansen, J. Chem. Educ. Software, 8C2 , 1996. Set parameters: Increments: n = 100 Integration limits: xmin = -3 xmax = 3 \[ \Delta = \frac{xmax - xmin}{n-1} \nonumber \] Effective mass: \( \mu\) = 1 Force constant: k = 1 Calculate position vector, the potential energy matrix, and the kinetic energy matrix. Then combine them into a total energy matrix. i = 1 .. n j = 1 .. n x i = xmin + (i - 1) \( \Delta\) \[ V_{i,~j} = if \bigg[ i =j,~k (x_i)^4 ,~0 \bigg] \nonumber \] \[ T_{i,~j} = if \bigg[ i=j, \frac{ \pi ^{2}}{6 \mu \Delta ^{2}}, \frac{ (-1)^{i-j}}{ (i-j)^{2} \mu \Delta^{2}} \bigg] \nonumber \] Hamiltonian matrix: H = T + V Find eigenvalues: E = sort(eigenvals(H)) Display three eigenvalues: m = 1 .. 3 E m = \( \begin{array}{|r|} \hline \\ 0.6680 \\ \hline \\ 2.3936 \\ \hline \\ 4.6968 \\ \hline \end{array} \) Calculate associated eigenfunctions: k = 1 .. 3 \[ \psi (k) = eigenvec (H, E_k) \nonumber \] Plot the potential energy and selected eigenfunctions: For V = ax n the virial theorem requires the following relationship between the expectation values for kinetic and potential energy: <T> = 0.5n<V>. The calculations below show the virial theorem is satisfied for the harmonic oscillator for which n = 4. \( \begin{pmatrix} "Kinetic~Energy" & "Potential~Energy" & "Total~Energy" \\ \psi (1)^{T} T \psi(1) & \psi (1)^{T} V \psi(1) & E_{1} \\ \psi (2)^{T} T \psi(2) & \psi (2)^{T} V \psi(2) & E_{2} \\ \psi (3)^{T} T \psi(3) & \psi (3)^{T} V \psi(3) & E_{3} \end{pmatrix} = \begin{pmatrix} "Kinetic~Energy" & "Potential~Energy" & "Total~Energy" \\ 0.4453 & 0.2227 & 0.6680 \\ 1.5958 & 0.7979 & 2.3936 \\ 3.1312 & 1.5656 & 4.6968 \end{pmatrix} \)