function integral = simplex01_monomial_integral ( m, e )

%*****************************************************************************80
%
%% simplex01_monomial_integral(): integrals in the unit simplex in M dimensions.
%
%  Discussion:
%
%    The monomial is F(X) = product ( 1 <= I <= M ) X(I)^E(I).
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    15 January 2014
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer M, the spatial dimension.
%
%    integer E(M), the exponents.  
%    Each exponent must be nonnegative.
%
%  Output:
%
%    real INTEGRAL, the integral.
%
  if ( any ( e(1:m) < 0 ) )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'SIMPLEX01_MONOMIAL_INTEGRAL - Fatal error!\n' );
    fprintf ( 1, '  All exponents must be nonnegative.\n' );
    error ( 'SIMPLEX01_MONOMIAL_INTEGRAL - Fatal error!\n' );
  end

  k = 0;
  integral = 1.0;

  for i = 1 : m

    for j = 1 : e(i)
      k = k + 1;
      integral = integral * j / k;
    end

  end

  for i = 1 : m
    k = k + 1;
    integral = integral / k;
  end

  return
end
