%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Master Pro 2 SNM
%2006/2007
%
%Mise en oeuvre de la methode de Leverrier pour calculer l'inverse d'une matrice
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clear all
n=10
A=gallery('tridiag',n);

Id=eye(n,n);
B=Id;

for k=1:n-1
    AB=A*B;
    alpha=trace(AB)/k;
    B=alpha*Id-AB;
    mesh(B/alpha*A)
    drawnow
    pause(1)
end
 alpha=trace(A*B)/n;
AI=B/alpha;