% Script P2
% Tests CorrectionTerm
  clc
  randn('seed',0);
  n = 100; k = 10;
  A = randn(n,n); A = A/norm(A);
  u = randn(n,1); u = u/norm(u);
  v = randn(n,1); v = v/norm(v);
 
  B0 = (A+u*v')^k;
  [X,Y] = CorrectionTerm(A,u,v,k);
  B = A^k + X*Y';
  err = norm(B - B0)