### Section 8.7

Problems 6, 8, 11b, 12e, 14, 15

### Extra Problem

Choose 10 random values, "eig_true = rand(10,1)". Use these to define a diagonal matrix D. Now pick a random 10x10 matrix U, "U = rand(10,10)". Using U and D, define a matrix A whose eigenvalues are those of eig_true.

Ask matlab for the eigenvalues of A, "eig_matlab = eig(A)".
You want to compare them so you want to sort them in ascending order. Do this with "eig_true = eig_true'; eig_true = sort(eig_true); eig_matlab = eig_matlab'; eig_matlab = sort(eig_matlab);" Since sort will sort a row vector and at the moment eig_true is a column vector. The prime "'" gives the transpose, and the transpose of a column is a row.

Now use the power method to find the two largest eigenvalues of A. Think of some intelligent way to do the iteration until you've reached a small error. (Explain how you did it and how many iterates it took for each eigenvalue to reach that error.)
Compare your eigenvalues to the true eigenvalues. Compare matlab's eigenvalues to the true eigenvalues. Compare your eigenvectors to the true eigenvectors (you do know them exactly if you know where to look!).

Now repeat the problem with personally chosen eigenvalues. How can you choose them to make the errors smaller? How can you choose them to make the errors larger?

If something didn't go according to plan, can you figure out what happened?

If you're having problems with the above problem, then do the following. Instead of constructing A as above, just take A = rand(10,10), and then make a symmetric matrix A = A + A'. Use matlab to find the "true" eigenvalues v = eig(A), and then use the power method to find the two largest eigenvalues and their eigenvectors. Compare them to the "true" eigenvalues (as found by matlab).

### Section 8.8

Problems 4 - 8

For problem #4, you'll need to modify the two codes from the web-page so that you have the right stopping criterion. Make sure to hand in copies of your modified code.
For problem #7, use the zero vector as your first guess.