function integral = annulus_monomial_integral ( r1, r2, e )

%*****************************************************************************80
%
%% annulus_monomial_integral() returns monomial integrals over an annulus.
%
%  Discussion:
%
%    A circular annulus centered at the origin, with inner radius R1 and
%    outer radius R2, is the set of points (X,Y) so that
%
%      R1^2 <= X^2 + Y^2 <= R2^2
%
%    The monomial is F(X,Y) = X^E(1) * Y^E(2).
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    04 November 2022
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real r1, r2: the inner and outer radii.
%    0.0 <= R1, and normally R1 <= R2.
%
%    integer e(2): the nonnegative exponents of X and Y.
%
%  Output:
%
%    real integral: the integral.
%
  if ( any ( e(1:2) < 0 ) )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'disk01_monomial_integral(): Fatal error!\n' );
    fprintf ( 1, '  All exponents must be nonnegative.\n' );
    error ( 'disk01_monomial_integral(): Fatal error!' );
  end

  if ( any ( mod ( e(1:2), 2 ) == 1 ) )
    integral = 0.0;
    return
  end

  integral = 2.0;
  for i = 1 : 2
    arg = 0.5 * ( e(i) + 1 );
    integral = integral * gamma ( arg );
  end

  arg = 0.5 * ( sum ( e(1:2) + 1 ) );
  integral = integral / gamma ( arg );
%
%  The surface integral is now adjusted to give the volume integral.
%
  s = sum ( e(1:2) ) + 2;

  integral = integral * ( r2 ^ s - r1 ^ s ) / s;

  return
end

