function [u,it] = Chebyshev(A,b,u0,prec,lambda1,lambdan,itMax)

n = length(u0);
u = u0;
r0 = b-A*u;
normr0 = norm(r0);
r = r0;
it = 0;

while norm(r)>prec*normr0 && it<itMax
    omega = cos(pi*(it+0.5)/n) * (lambdan-lambda1)/2 + (lambdan+lambda1)/2;
    u = u + (1/omega)*r;
    r = b-A*u;
    it = it+1;
end

