Physics 780.20: Assignment #3
Here are some hints, suggestions, and comments on the assignment.
- The updated version of derivative_test.cpp
is available here.
- Note that extrap_diff calls central_diff with two different h's
and then extrap_diff2 (which you are to write) calls extrap_diff twice
(and NOT central_diff twice). Your error plot should show a slope of
- When writing an adaptive code (first bonus problem),
you can assume that the
round-off error part of the error is given by the machine precision
divided by h (as described in Chapter 8). In practice this may
overestimate the actual error.
- If you know that the relative error scales in the "approximation
error region" as b*h2 for the central difference formula.
How can you determine b from evaluating the derivative at two
different h values (without knowing the exact answer)?
- The results are most interesting is you pick a value for the
harmonic oscillator parameter b that
is not optimal. Or, if possible, compare results with
two different values of b.
- Assign variables to the minimum, maximum, and increment values for
the radial value r. For example, rmin=0., rmax=10., delta_r=0.05
are reasonable choices.
- Plot the results for different dimension bases on the same gnuplot
plot. This is made much easier by using a plot file that uses a
different datafile for each basis size, rather than trying to make one
datafile with all of the results. (You can rename the output
files from your code each time you change the basis size.)
- When commenting on the nature of the convergence, you might note
what part of the wave function is reproduced first (e.g., when is the
tail reproduced?). If you chose a different value for b, how might the
convergence change? (What is most important to get a fit with
dimension size 1?)
- For the second bonus problem,
think about how you measure the goodness of fit when
you fit a straight line to some data points. Can you do something
analogous when you have a function of r like a wave function?
Physics 780.20: Assignment #3 hints.
Last modified: 03:08 pm, February 01, 2006.