% Programming and Numerical Methods
% MSc in Computational and Applied Physics

% Code 14: Gauss - Legendre quadrature formula
% using Quarteroni, Sacco Saleri 2007 ZPLEGE routine
% Algorithm 726: ORTHPOL
% Gautschi, W., ACM Trans. Math. Soft., 20(1), 21-62, 1994

  function integ = glcf(a,b,n,myfun)
  [t,w] = zplege(n) ;

  x = (b-a)*t/2 + (a+b)/2 ;
  f = feval(myfun,x) ;
  integ = ((b-a)/2)*sum(f.*w) ;






