function disk01_positive_monte_carlo_test01 ( )

%*****************************************************************************80
%
%% disk01_positive_monte_carlo_test01() demonstates the Monte Carlo method.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    28 November 2021
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'disk01_positive_monte_carlo_test01():\n' );
  fprintf ( 1, '  disk01_positive_sample() samples the unit positive disk.\n' );

  for i = 0 : 4
    e(1) = i; 
    for j = 0 : 4 - e(1)
      e(2) = j;
      exact = disk01_positive_monomial_integral ( e );
      fprintf ( 1, '\n' );
      fprintf ( 1, '  Estimate integral of X^%d Y^%d\n', e(1), e(2) );
      fprintf ( 1, '\n' );
      fprintf ( 1, '         N        Estimate       Error\n' );
      fprintf ( 1, '\n' );

      n = 1;

      while ( n <= 65536 )

        x = disk01_positive_sample ( n );
        value = monomial_value ( 2, n, e, x );

        q = disk01_positive_area ( ) * sum ( value(1:n) ) / n;

        err = abs ( q - exact );
        fprintf ( 1, '  %8d  %14.6g  %10.2e\n', n, q, err );
        n = 2 * n;

      end
      fprintf ( 1, '    Exact:  %14.6g  %10.2g\n', exact, 0.0 );
    end

  end

  return
end
