function quadrature_playoff ( )

%*****************************************************************************80
%
%% quadrature_playoff compares several quadrature rules on a single problem.
%
  a = 0.0;
  b = 1.0;
  q_exact = pi / 2.0;
% q_exact = hump_int ( 0.0, 2.0 );

  fprintf ( 1, '\n' );
  fprintf ( 1, 'quadrature_playoff:\n' );
%
%  Trapezoid composite (actually uses n+1 points).
%
  n = 16;
  x = linspace ( a, b, n + 1 );
  q = ( b - a ) * ( 1.0 / n ) * ( 0.5 * f(x(1)) + sum ( f(x(2:n)) ) + 0.5 * f(x(n+1)) );
  fprintf ( 1, '  16*T2   %20.16g  %8.4g\n', q, abs ( q_exact - q ) );
%
%  8*S3
%
  n = 8;
  x = linspace ( a, b, 2 * n + 1 );

  q =              f(x(1) ) ...
     + 4.0 * sum ( f(x(2:2:2*n)) ) ...
     + 2.0 * sum ( f(x(3:2:2*n-1)) ) ...
     +             f(x(2*n+1));
  q = ( b - a ) * q / 6.0 / n;

  fprintf ( 1, '   8*S3   %20.16g  %8.4g\n', q, abs ( q_exact - q ) );
%
%  C16.
%
  nint = 1;
  n = 16;
  [ x, w ] = clenshaw_curtis_ab ( n, a, b );
  q = w' * f(x);
  fprintf ( 1, '   1*C16  %20.16g  %8.4g\n', q, abs ( q_exact - q ) );
%
%  4*C4.
%
  nint = 4;
  npts = 4;

  s = linspace ( a, b, nint + 1 );
  q = 0.0;
  for i = 1 : nint
    [ x, w ] = clenshaw_curtis_ab ( npts, s(i), s(i+1) );
    q = q + w' * f(x);
  end
  fprintf ( 1, '   4*C4   %20.16g  %8.4g\n', q, abs ( q_exact - q ) );
%
%  Gn.
%
  n = 16;
  [ x, w ] = gauss_ab ( n, a, b );
  q = w' * f(x);
  fprintf ( 1, '   1*G16  %20.16g  %8.4g\n', q, abs ( q_exact - q ) );
%
%  4*G4.
%
  nint = 4;
  npts = 4;

  s = linspace ( a, b, nint + 1 );
  q = 0.0;
  for i = 1 : nint
    [ x, w ] = gauss_ab ( npts, s(i), s(i+1) );
    q = q + w' * f(x);
  end
  fprintf ( 1, '   4*G4   %20.16g  %8.4g\n', q, abs ( q_exact - q ) );
%
%  MC16
%
  n = 16;
  x = rand(n,1);
  q = ( b - a ) * ( 1.0 / n ) * sum ( f(x) );
  fprintf ( 1, '   1*MC16 %20.16g  %8.4g\n', q, abs ( q_exact - q ) );

  return
end
function value = f ( x )
  value = 1.0 ./ ( x.^2 + ( 1.0 - x ).^2 );
% value = humps ( x );
  return
end


