function [ABSCISSAS, WEIGHTS]=Gauss_leg(NUM)
% Generates the abscissas and weights for an even 2*NUM point
% Gauss-Legendre quadrature.  Only the NUM positive points are returned.
 
 TINY=3.0E-14;
 N=2*NUM;
 for J=1:NUM
   X=cos(pi*(J-.25)/(N+.5));
   I=0;
 while (1>0)
   PL1=1;
   PL=X;
   for L=2:N
    PL2=PL1;
    PL1=PL;
    PL=((2*L-1)*X*PL1-(L-1)*PL2)/L;
   end 
   DPL=N*(X*PL-PL1)/(X*X-1);
   XP=X;
   X=XP-PL/DPL;
   I=I+1;
   if ((abs(X-XP)>TINY)&(I<10)) 
       
    else
      break
  end   
end
      ABSCISSAS(NUM+1-J)=X;
      WEIGHTS(NUM+1-J)=2/((1-X*X)*DPL*DPL);      
  end
    