function glpairtabulated_test ( )

%*****************************************************************************80
%
%% glpairtabulated_test() tests glpairtabulated().
%
%  Discussion:
%
%    Test the numerical integration of exp(x) over the range [-1,1]
%    for varying number of Gauss-Legendre quadrature nodes l.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    06 January 2016
%
%  Author:
%
%    Original C++ version by Ignace Bogaert.
%    MATLAB version by John Burkardt.
%
%  Reference:
%
%    Ignace Bogaert,
%    Iteration-free computation of Gauss-Legendre quadrature nodes and weights,
%    SIAM Journal on Scientific Computing,
%    Volume 36, Number 3, 2014, pages A1008-1026.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'GLPAIRTABULATED_TEST:\n' );
  fprintf ( 1, '  integral ( -1 <= x <= 1 ) exp(x) dx\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '    Nodes           Estimate\n' );
  fprintf ( 1, '\n' );

  for l = 1 : 9
    q = 0.0E+00;
    for k = 1 : l
      [ theta, weight, x ] = glpairtabulated ( l, k );
      q = q + weight * exp ( x );
    end
    fprintf ( 1, '  %7d  %24.16g\n', l, q );
  end

  fprintf ( 1, '\n' );
  fprintf ( 1, '    Exact  %24.16g\n', exp ( 1.0E+00 ) - exp ( -1.0E+00 ) );

  return
end


