Docsity

Assignment 10 - Compute Linear Algebra | MATH 513, Assignments of Mathematics

Toggle sidebar
bg1
MATH 513 Spring 2009, Homework 10, Addendum
It’s usually hard to compute eigenvalues of a matrix – primarily because
it involves finding roots of polynomials, which is hard. However, there is one
easy way to compute the largest and smallest real eigenvalues called the “Power
method”.
Here’s what it does for a square matrix Aand a given tolerance > 0:
1. Choose a random unit vector x0. Make sure its size is compatible with A.
Set k= 1.
2. Repeat the following until kxk−xk−1k ≤ :
(a) Let yk=Axk−1
(b) Let xk=yk/kykk
(c) Increment k
3. The eigenvalue is kykkand the eigenvector is xk.
Problem 1 Take the above verbal description and turn it into a Matlab
function. Take a few random 5x5 matrices and try it out with a tolerance of
10−5. Compare the results of your function with the results of Matlab’s “eig”
command. (Hint: they had better be close!)
Problem 2 How can you modify the above algorithm to find the smallest
eigenvalue? Write another Matlab function to do this and test it. (Hint: you’ll
want to avoid taking inverses as usual, though you’d really want to, theoreti-
cally.)

Partial preview of the text

Download Assignment 10 - Compute Linear Algebra | MATH 513 and more Assignments Mathematics in PDF only on Docsity!

MATH 513 Spring 2009, Homework 10, Addendum

It’s usually hard to compute eigenvalues of a matrix – primarily because it involves finding roots of polynomials, which is hard. However, there is one easy way to compute the largest and smallest real eigenvalues called the “Power method”. Here’s what it does for a square matrix A and a given tolerance  > 0:

  1. Choose a random unit vector x 0. Make sure its size is compatible with A. Set k = 1.
  2. Repeat the following until ‖xk − xk− 1 ‖ ≤ :

(a) Let yk = Axk− 1 (b) Let xk = yk/‖yk‖ (c) Increment k

  1. The eigenvalue is ‖yk‖ and the eigenvector is xk.

Problem 1 Take the above verbal description and turn it into a Matlab function. Take a few random 5x5 matrices and try it out with a tolerance of 10 −^5. Compare the results of your function with the results of Matlab’s “eig” command. (Hint: they had better be close!) Problem 2 How can you modify the above algorithm to find the smallest eigenvalue? Write another Matlab function to do this and test it. (Hint: you’ll want to avoid taking inverses as usual, though you’d really want to, theoreti- cally.)