//Méthode du gradient à pas constant
function [X,n]=gpc(A,B,alpha,X0,nmax,tol)

X=X0; R=B-A*X;
for n=0:nmax
  if (norm(R)<=tol), break, end
  X=X+alpha*R;
  R=B-A*X;
end

endfunction