function annulus_integrals_test01 ( r1, r2, n )

%*****************************************************************************80
%
%% annulus_integrals_test01() compares exact and Monte Carlo integral estimates.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    04 November 2002
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real r1, r2: the inner and outer radius.
%
%    integer n: the number of sample points.
%
  m = 2;
  test_num = 20;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'annulus_integrals_test01():\n' );
  fprintf ( 1, '  Estimate monomial integrals using Monte Carlo method\n' );
  fprintf ( 1, '  over the interior of an annulus centered at the origin.\n' );
%
%  Get sample points.
%
  x = annulus_sample ( r1, r2, n );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Inner radius is %g\n', r1 );
  fprintf ( 1, '  Outer radius is %g\n', r2 );
  fprintf ( 1, '  Number of sample points is %d\n', n );
%
%  Randomly choose X,Y exponents between 0 and 8.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '  If any exponent is odd, the integral is zero.\n' );
  fprintf ( 1, '  We will restrict this test to randomly chosen even exponents.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Ex  Ey     MC-Estimate           Exact      Error\n' );
  fprintf ( 1, '\n' );

  for e1 = 0 : 2 : 8

    for e2 = 0 : 2 : 8

      e = [ e1, e2 ];

      value = monomial_value ( m, n, e, x );

      result = annulus_area ( r1, r2 ) * sum ( value(1:n) ) / n;
      exact = annulus_monomial_integral ( r1, r2, e );
      error = abs ( result - exact );

      fprintf ( 1, '  %2d  %2d  %14.6g  %14.6g  %10.2e\n', ...
        e(1:m), result, exact, error );

    end
  end

  return
end
