% Numerical Mathematics and Computing, Fifth Edition
% Ward Cheney & David Kincaid
% Brooks/Cole Publ. Co.
% (c) 2003
%
% file: inv_power.m

% inverse power method
% 
A = [6 5 -5; 2 6 2; 2 5 -1]
B = inv(A)
x = [-1; 1; 1]
for k=1:30
  y = B*x;
  r = x(2)/y(2)
  x = y/norm(y)
end

A = [6 5 -5; 2 6 2; 2 5 -1]
x = [-1; 1; 1]
for k=1:30
  y = A*x;
  r = y(2)/x(2)
  x = y/norm(y)
end
