
     clear; close 
   
     N =input(  'N=  ');
     eps=input(  'eps=  ');

     z=zeros(N+1,N+1);

     z(1,1)=0;  z(1,2)=1;

     for n=2:N+1
        a=-1;
          for k=1:n 
            b=z(n-1,k);

%SECANT METHOD
         while abs(a-b) >= eps

            ab=0.5*(a+b);
            if Leg0(N+1,a)*Leg0(N+1,ab)<0
               b=ab;
            else
               a=ab;
            end

          end

          z(n,k)=ab;

           a=ab+N^(-2);
           end

         z(n,n+1)=1;
       end

     for j=1:N+1
         xxx(j)=j;
         err(j)=z(N+1,j);
     end

     fprintf(1,      '%9.0f          %12.8f  \n', [xxx;err]);


