function tn = chebpoly(deg,x)
% -------------------------------------------------------------------------
% computes the Chebyshev polynomials on the real line by recurrence
t0=ones(length(x),1);
t1=x;
if deg==0
    tn=t0;
end;
if deg>0
    for j=2:deg
        t2=2*x.*t1-t0;
        t0=t1;
        t1=t2;
    end;
    tn=t1;
end;
end
