Notebooks · posts/make-power-iteration-converge-on-a-tied-pair
Make power iteration converge on a tied pair
Power iteration multiplies a vector by again and again and finds the eigenvalue of largest magnitude. The matrix above has two, and , of the same magnitude, and the iterate swaps its two entries every step forever. Write shifted_power so that the shift breaks the tie: iterate with , whose eigenvalues are .
Write in the eigenvectors, . After steps : the two parts stay the same size, and the sign of one flips each step. From the normalized iterate alternates between and , and its Rayleigh quotient is 1.101, which is neither eigenvalue.
has the same eigenvectors, with eigenvalues and . With those are 3 and , so the part wins by a factor of 3 per step; with they are 1 and , and wins. The Rayleigh quotient of the original then gives the eigenvalue itself.
The second matrix, , has
eigenvalues , again a tie. The expected vectors are
numpy.linalg.eigh's (posts/refs/make-power-iteration-converge-on-a-tied-pair.py),
signed so that the first entry is positive; the function must return its
vector signed the same way.
Look inside this program
- Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
This is a problem: its tests fail until the functions in it are written. Edit a cell and run it to try; the cells below it show whether the tests pass.
Shift+Enter in a cell runs it and moves to the next. Running a cell runs every cell above it too, as one program.