% Numerical Mathematics and Computing, Fifth Edition % Ward Cheney & David Kincaid % Brooks/Cole Publ. Co. % (c) 2003 % % file: small_eig.m % compute smallest eigenvalue/eigenvector via inverse power method % A = (1/3)*[-155 528 407; 55 -144 -121; -132 396 318] B = inv(A) x = [1; 2; 3] for k=1:80 y = B*x; r(k) = x(2)/y(2) x = y/norm(y, inf); end for k=3:80 s(k) = (r(k-2)*r(k)-r(k-1)^2)/(r(k)-2*r(k-1)+r(k-2)) end format long r(80), s(80), x, A*x, s(80)*x