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.
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:
We will test your program with the command
anharm.py < testinputwhere our test input file contains a single set of values, epsilon and n.
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.