function circle_mc ( nmax )

%*****************************************************************************80
%
%% circle_mc estimates an integral over the unit circle using Monte Carlo.
%
%  Input:
%
%    integer nmax: the number of points to use in the estimate.
%
  n = 0;
  q = 0.0;
  
  while ( n < nmax )
    x = rand();
    y = rand();
    if ( x^2 + y^2 <= 1.0 )
      n = n + 1;
      q = q + sin(x) * exp ( x + y );
    end
  end
  
  q = q * pi / n;
  fprintf ( 1, '  Using %d points, integral estimate is %g\n', n, q );

  return
end


