In this assignment you will solve the radial Schroedinger equation for the hydrogen atom. See the hydrogen atom handout for a discussion of the equation.
For each of the following exercises create the specified files with your answer(s). Submit your homework using the course submit utility.
The equation we are solving here has singular points at both endpoints of integration, namely r = 0 and r = infinity. The best strategy is always to integrate away from a singular point. So our shooting procedure involves integrating from both ends toward a common matching point, r = c. At c we must match the values of the function and its derivative resulting from the two integrations. At the starting point of both integrations, we select initial values of the function and its derivative. For each integration the initial value is zero and the derivative is arbitrarily set to 1.
u1(c) du2(c) - u2(c) du1(c) = 0
then so do v1(x) and u2(x) and
their derivatives.
Note that the same conclusion applies to a change in the normalization of the solution u2(x). In this way we can always adjust the normalization of our original solution on the right and left so the wavefunction and its derivative are continuous on the whole interval and the square integral of the wavefunction is 1.
Please put your answers in a file setup.txt
| File | Purpose of procedure |
|---|---|
| bohr.cc | Driver (main) program. (provided) |
| bsrf.cc | Finds the zero. (provided) |
| wavef.cc | Your modified driver. (Incomplete). |
| hydrogen_derivs.cc | Evaluates the rhs of the ODEs. (You write) |
| param.h | Defines parameter classes. (provided) |
| Makefile | Rule for compiling the above. (provided) |
Although most of the code is provided, it is important that you understand how it works. Here is a diagram showing the module names and hierarchy of subprogram calls for this code:
bohr | v bsrf | v matchf | v wavef | v NR::rkqs | v NR::rk4 | v hydrogen_derivs
This program sets the parameters of the integration, prompts for
the angular momentum, and prompts for a range of eigenvalues in which
to search for the eigenvalue. The eigenvalue must be bracketed. This
routine calls bsrf to locate the zero of the function
matchf (as a function of the energy) and reports the answer, if
successful.
Adapted from Numerical Recipes. The design of this subprogram should be
somewhat familiar to you from last quarter. It is a general purpose
routine for finding the zeros of any function of a single variable.
It locates the zero of a function using two methods: first the
bisection method for a rough determination, and then the regula falsi
method to polish. It calls your routine matchf.
This subprogram is built after the pattern of your program
anhrkqc from the previous assignment. It integrates any
second-order linear eigenvalue problem specified by your subprogram,
in this case hydrogen_derivs, starting from a zero value and
specified slope at the endpoint a and going to the endpoint
b with initial stepsize dr and error scale eps.
It returns the value of y and its derivative at the second
endpoint. Please note that the notation for the endpoints
a and b has local scope only. These are variables set
in matchf, depeding on which half of the wave function is being
constructed.
This subprogram calls wavef twice, once to do the integration from a to c and then to do the integration from b to c. It then evaluates the matching expression and returns the value. To complete the code, insert the correct formula for the matching expression in the location specified by comments in the code.
The subprogram hydrogen_derivs is called by NR::rk4 and wavef. The purpose of hydrogen_derivs is the same as anhderivs in Assignment 3.
bohr | sort -n > wavef.txt
and hit Crtl-d after the first successful eigenvalue
determination. Use gnuplot to plot the contents of wavef.txt.
Do this for your third eigenvalue for angular momentum 2. Your result
for this eigenvalue was not as good as the others. After comparing
with a couple other plots, can you suggest a reason for the larger
discrepancy? What should you do to improve the answer? Put your
explanation and answers (but not the plot file) in results.txt.