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
Plot[
Evaluate[
u[x] /.
NDSolve[
{u''[x] -(x^2 - K)*u[x] == 0, u[0] == 1, u'[0] == 0},
u[x], {x, 0, b}
]
],
{x, a, b}, 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=2n+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.