%
%  Plot the function.
%
  x = -1.0 : 0.01 : +1.0;
  y = -1.0 : 0.01 : +1.0;

  [ X, Y ] = meshgrid ( x, y );

  Z = abs ( X .* X + Y .* Y - 0.75 );

  surf ( X, Y, Z, 'FaceColor', 'Interp', 'EdgeColor', 'Interp' )
  xlabel ( 'X' );
  ylabel ( 'Y' );
  zlabel ( 'Z=F(X,Y)' )
  title ( 'Z = | X^2 + Y^2 - 3/4|' )
%
%  Get exact value from Mathematica.
%
  exact = 1.433812586520645;
  area = 4.0;

  n = 1;

  for logn = 0 : 7

    x = -1.0 + 2.0 * rand ( n, 1 );
    y = -1.0 + 2.0 * rand ( n, 1 );

    result = area * sum ( abs ( x .* x + y .* y - 0.75 ) ) / n;

    fprintf ( 1, '  %8d  %f  %e\n', n, result, abs ( result - exact ) );

    n = n * 10;

  end
