This notebook contains an excerpt from the Python Programming and Numerical Methods - A Guide for Engineers and Scientists, the content is also available at Berkeley Python Numerical Methods.
The copyright of the book belongs to Elsevier. We also have this interactive book online for a better learning experience. The code is released under the MIT license. If you find this content useful, please consider supporting the work on Elsevier or Amazon!
< 15.4 Eigenvalues and Eigenvectors in Python | Contents | CHAPTER 16. Least Squares Regression >
Summary¶
Eigenvalues and eigenvectors help us to understand the characteristics of the linear transformation.
Eigenvectors of a matrix are the vectors that only be scaled length without rotation after the matrix transformation, the eigenvalues are the factors of the scale.
We can use power method to get the largest eigenvalue and corresponding eigenvector of a matrix.
The inverse power method can help us to get the smallest eigenvalue and corresponding eigenvector of a matrix.
The shifted power method can get all the other eigenvectors/eigenvectors of a matrix.
The preferred method to get all the eigenvalues is the QR method.
Problems¶
Write down the characteristic equation for matrix \(A = \begin{bmatrix} 3 & 2\\ 5 & 3\\ \end{bmatrix}\).
Using the above characteristic equation to solve for eigenvalues and eigenvectors for matrix \(A\).
Using the first eigenvector that derived from problem 2 to verify that \(Ax = \lambda{x}\).
Get the largest eigenvalue and eigenvector for matrix \(A = \begin{bmatrix} 2 & 1 & 2\\ 1 & 3 & 2\\ 2 & 4 & 1\\ \end{bmatrix}\) using the power method. You can start with initial vector [1, 1, 1], see what you will get after 8 iterations.
Using the inverse power method to get the smallest eigenvalue and eigenvector for the matrix in problem 4. See how many iterations do you need for it to converge to the smallest eigenvalue.
Do a QR decomposition for matrix \(A\) in problem 4, and verify that \(A=QR\) and \(Q\) is an orthogonal matrix.
Use the QR method to get all the eigenvalues for matrix \(A\) in problem 4.
Get the eigenvalues and eigenvectors for the matrix \(A\) in problem 4 using the Python built-in function.
< 15.4 Eigenvalues and Eigenvectors in Python | Contents | CHAPTER 16. Least Squares Regression >