function [l,y,n]=potenze(A,x0,toll,nmax)
x=x0;
y=x/norm(x);
x=A*y;
l_old=y'*x;
y=x/norm(x);
n=0;
do
x=A*y;
l=y'*x;
y=x/norm(x);
err=abs(l-l_old)/abs(l);
l_old=l;
n=n+1;
until (n>nmax | err < toll)
