Physics 3730/6720 Assignment 7

Reading and references:


For each of the following exercises create the specified files with your answer(s). Submit your homework using the course submit utility as usual.


Exercise 1. Program of the week: Anharmonic oscillator

The purpose of this exercise is to solve a real-life eigenvalue problem (find the eigenvalues of a given matrix). This eigenvalue problem solves the one-dimensional anharmonic oscillator problem in quantum mechanics. See the notes "Anharmonic Oscillator" for a discussion of the physics and a specification of the matrix to be diagonalized (i.e. whose eigenvalues we are to compute). You should use whatever numerical method you find most appropriate in the LAPACK library. Your task is to find an appropriate subroutine using the available documentation and what you have learned about diagonalization methods, and write a main program that sets up the problem in double precision, calls the subroutine, and reports the answer. Your answer will be evaluated, not only for the correctness of the answer, but also for your judgment in selecting the algorithm and the efficiency of your approach in a obtaining a solution. Please note: if you are having trouble with any of the special-purpose eigensolvers, you should use a general purpose eigensolver, which takes a plain square matrix. We put greater emphasis on getting the correct answer than on efficiency of storage. If you succeed with a more efficient special purpose eigensolver, we will give bonus points.

Although the matrix whose eigenvalues we seek is infinite, let's keep at most only the first 14 rows and columns. The number n of rows and columns actually used and the value of the parameter epsilon (see the notes) are to be read in at execution time. You are to find the eigenvalues of the n x n matrix

              anh
             h     = (i + 1/2) \delta    + \epsilon g
              ij                     ij              ij
for i,j = 0,1,2...,n-1. The \delta_{ij} is the Kronecker delta and the \epsilon is the epsilon parameter.

The 14 x 14 version of the matrix gij is given explicitly in the file ~p6720/examples/anharm/g14. A key question: Is it a symmetric matrix? The rows and columns correspond to i,j ranging from 0 to 13. If you want just the values on the non-zero bands, see the file ~p6720/examples/anharm/g14band. If you prefer, you may instead set up the problem so that the matrix elements are computed by your program, using the formulas given in the notes. (Be sure to find the eigenvalues of h and not just g!).

Here is how your program should perform, so it can be tested by our automatic system:

These are the files to be submitted: anharm.cc, Makefile and (optional) data. The Makefile should have all the proper references to the library routines. (Submit the data file if your code requires it.)

We will test your program with the command

    anharm < testinput
where our test input file contains a single set of values, epsilon and n.

For notes on calling LAPACK routines, please see the links at the top of this page. Some LAPACK routines call for a single character argument, such as JOBZ = 'N' or 'V' and the C/C++ prototype specifies dzzzz(char jobz, ...). In that case just pass a character constant with single quotes like this:

     dzzzz('N', ...)

Exercise 2. Running your program

Do the diagonalization (find the eigenvalues) for n = 8, 10, 12, and 14 and epsilon = 0.15 and see how the lowest three eigenvalues are converging.

In a file called anharm.txt list the resulting eigenvalues, and compare the change in each in going from 12 to 14. Which eigenvalues change the most? This change suggests to what extent the answer has converged. Discuss.

If you want to try my compiled code, it is in ~p6720/examples/anharm/anharm.


This page is maintained by:
Carleton DeTar Mail Form
Last modified 10 November 2008