% Program 85 from Quarteroni, Sacco and Saleri 2007 
% Nodes and weights of Gauss-Legendre polynomials
% Algorithm 726: ORTHPOL
% Gautschi, W., ACM Trans. Math. Soft., 20(1), 21-62, 1994

  function [x,w] = zplege(n)
  [a,b] = coeflege(n) ;
  JacM = diag(a) + diag(sqrt(b(2:n)),1) + diag(sqrt(b(2:n)),-1);
  [w,x] = eig(JacM) ; x = diag(x) ; scal = 2 ; w = w(1,:)'.^2*scal ;
  [x,ind] = sort(x) ; w = w(ind) ;
 

