Consider Schrödinger's differential equation,
. This problem describes the quantum harmonic oscillator (i.e., the quantum-mechanical analog of the classical harmonic oscillator). Values of the eigenvalues
can be determined analytically and are
. The corresponding eigenfunctions are given by
are the Hermite polynomials associated with the eigenvalue
. This Demonstration approximates values of the eigenvalues numerically using spectral methods. When the number of grid points is large, the numerical values match their analytical counterparts perfectly. In addition, the first five eigenfunctions (analytical solutions in blue and numerical solution in red dots) are plotted for the choice of 100 grid points.