function InterpolaceCebysevova_Runge()

a = -5; b = 5;

N = 100;

for n=0:N
    xvlnka = cos(pi*(2*[0:n]+1)/(2*(n+1)));
    x = (a+b)/2 + xvlnka*(b-a)/2;
    
    f = 1./(1+x.^2);
    
    xx = a:0.1:b;
    fn = xx; fn(:) = 0;
    for j=0:n
        Lj = xx; Lj(:) = 1;
        for k=0:n
            if j==k
                continue;
            end
            Lj = Lj .* ((xx-x(k+1)))./(x(j+1)-x(k+1));
        end
        fn = fn + f(j+1)*Lj;
    end
    n
    plot(xx,fn,'r',xx,1./(1+xx.^2),'k')
    pause
end