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

% modified power method
% 
A = [6 5 -5; 2 6 -2; 2 5 -1]
x = [-1; 1; 1]
for k=1:14
  y = A*x;
  r(k) = y(2)/x(2)
  x = y/norm(y, inf)
end
for k=3:14
  s(k) = (r(k-2)*r(k)-r(k-1)^2)/(r(k)-2*r(k-1)+r(k-2));
end
r, s
format long
x, r(14), s(14), b = A*x, y = s(14)*x, b-y
