Find the ground state energy of the harmonic oscillator, to five significant digits, by the “wag-the-dog” method. That is, solve Equation 2.73 numerically, varying K until you get a wave function that goes to zero at large ξ. In Mathematica, appropriate input code would be
\frac{d^{2} \psi}{d \xi^{2}}=\left(\xi^{2}-K\right) \psi . (2.73)
Plot[
Evaluate[
u[x] /.
NDSolve [
\left\{ u \prime \prime [ x ]-\left( x ^{2}- K \right)^{*} u [ x ]==0, u [0]==1, u\prime [0]==0\right\} ,
u [ x ],\{ x , 0, b \}]
],
\{ x , a , b \}, \text { PlotRange }->\{ c , d \}]
(Here (a,b) is the horizontal range of the graph, and (c,d) is the vertical range—start with a = 0 , b =10 , c = -10 , d = 10 ) We know that the correct solution is K = 2 n + 1 , so you might start with a “guess” of K= 0.9. Notice what the “tail” of the wave function does. Now try K= 1.1 , and note that the tail flips over. Somewhere in between those values lies the correct solution. Zero in on it by bracketing K tighter and tighter. As you do so, you may want to adjust a, b, c, and d, to zero in on the cross-over point.