Write a program that uses the shifted inverse power method to find an approximation to the eigenvalue of a matrix which is closest to a given number and the corresponding eigenvector. In addition to the matrix A and the number , the program should take as inputs a limit, m, on the number of iterations and a tolerance (not necessarily the machine ``epsilon'') whose role is explained below. It should also take as input an initial approximation, v, to the eigenvector. The program should terminate when successive estimates of the eigenvalue differ by less than or when the number of iterations reaches m. The program should use Rayleigh quotients to estimate the eigenvalue. The program should return the final estimate of the eigenvalue, the corresponding eigenvector estimate and information as to whether the method converged.
An optional addition to the return values of the program would be a list (vector) with all the (Rayleigh quotient) estimates of the eigenvalue, and a matrix with the corresponding eigenvector extimates. Two optional additional programs and or additions to the program would be
Run the program on the following matrices and find all of their eigenvalues. The first digits of the eigenvalues are given. In each case use as initial guess.
(1) |
(2) |
(3) |
First digits of the eigenvalues: (Be sure to explain how you have used this information in relation to the theory of the convergence of the shifted inverse power method and the general theory of eigenvalues to assure that you have obtained all the eigenvalues for the given matrices.)