# Physics 3730/6720 Assignment 5

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. Anharmonic oscillator

The purpose of this exercise is to solve a real-life eigenvalue problem (find the eigenvalues of a given matrix). We will solve a 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).

Although the matrix 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 $h^{anh}_{ij} = (i + 1/2) \delta_{ij} + \epsilon g_{ij}$ for $$i,j = 0,1,2...,n-1$$. The $$\delta_{ij}$$ is the Kronecker "delta" and the $$\epsilon$$ is the epsilon parameter. The first matrix on the rhs above is a diagonal matrix, but the second matrix is not, but it is symmetric and real (See the notes for more detail.)

You can try building the matrix $$g_{ij}$$ for any size with your code for bonus points, or you can use the the 14 x 14 version of the matrix that is given explicitly in the file ~p6720/examples/anharm/g14. . Note that if you use this file for the matrix you still need to multiply it by $$\epsilon$$ and add the first term to get $$h_{ij}$$ . The rows and columns correspond to $$i,j$$ ranging from 0 to 13. (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:

• Name your code anharm.py. Your program should first read the value of epsilon from standard input. Then it should read the dimension n to be used from standard input. If you wish, you may loop over a list of values of n, terminating the program when an end-of-file is reached on standard input.
• If your program reads the file g14 please also submit that file. If you choose to evaluate the matrix from the formula, there is no need to do this.
• Your program should report just the eigenvalues (not the eigenvectors) of the matrix. Report them in order, sorted from lowest to highest.

We will test your program with the command

    anharm.py < testinput

where our test input file contains a single set of values, epsilon and 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 (lowest 12) in going from 12 to 14. Which eigenvalues change the most? This change suggests to what extent the answer has converged. Discuss.