function res = polyn( x,n,pp)

l = length(pp);

if n==0
    res = 1;
else
    if n==1
        res = x;
    else
        s1 = 0;
        s2 = 0;
        for kk = 1:l
            s1 = s1+pp(kk)*polyn(pp(kk),n-1,pp)*polyn(pp(kk),n-2,pp);
        end;
        for kk = 1:l
            s2 = s2+polyn(pp(kk),n-1,pp)*polyn(pp(kk),n-1,pp);
        end;
        res = polyn(x,n-1,pp)*x - polyn(x,n-2,pp)*s1/s2;
    end;
end;

end

