
     clear; close 

     N =input(  'N=  ');
     eps=input(  'eps=  ');
     m =input(  'm=  ');

     h=(N)^(-2);

        a=-1;

        for k=1:N-m 

        b=a+h;
       
        while Legendre(N,m,a)*Legendre(N,m,b) >0
           a=b;  b=b+h;
        end

%NEWTON's METHOD

             x=0.5*(a+b);  xx=b; 
             while abs(x-xx) >= eps 
               xx=x;
               ss1=Legendre(N,m,x);  ss2=Legendre(N,m+1,x);
               x=x-ss1/ss2;

             end
             z(k)=x;

         a=x+h; 

         end
         

     for j=1:N-m
         xxx(j)=j;
     end

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


