function disk_sample_test ( )

%*****************************************************************************80
%
%% DISK_SAMPLE_TEST() tests DISK_MEAN(), DISK_SAMPLE(), DISK_VARIANCE().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    17 March 2016
%
%  Author:
%
%    John Burkardt
%
  nsample = 1000;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'DISK_SAMPLE_TEST():\n' );
  fprintf ( 1, '  DISK_MEAN() returns the Disk mean.\n' );
  fprintf ( 1, '  DISK_SAMPLE() samples the Disk distribution.\n' );
  fprintf ( 1, '  DISK_VARIANCE() returns the Disk variance.\n' );

  a = 10.0;
  b = 4.0;
  c = 5.0;

  fprintf ( 1, '\n' );
  fprintf ( 1, '  X coordinate of center is A = %14g\n', a );
  fprintf ( 1, '  Y coordinate of center is B = %14g\n', b );
  fprintf ( 1, '  Radius is C =                 %14g\n', c );

  xmean = disk_mean ( a, b, c );
  v = disk_variance ( a, b, c );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Disk mean =     %14g  %14g\n', xmean(1), xmean(2) );
  fprintf ( 1, '  Disk variance = %14g\n', v );

  for i = 1 : nsample
    [ x1, x2 ] = disk_sample ( a, b, c );
    x_table(i,1) = x1;
    x_table(i,2) = x2;
  end

  variance = sum ( ( x_table(1:nsample,1) - a ) .^ 2 ...
                 + ( x_table(1:nsample,2) - b ) .^ 2 ) / nsample;

  for j = 1 : 2
    xmean(j) = mean ( x_table(1:nsample,j) );
    xmax(j) = max ( x_table(1:nsample,j) );
    xmin(j) = min ( x_table(1:nsample,j) );
  end

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Sample size =     %6d\n', nsample );
  fprintf ( 1, '  Sample mean =     %14g  %14g\n', xmean(1:2) );
  fprintf ( 1, '  Sample variance = %14g\n', variance );
  fprintf ( 1, '  Sample maximum =  %14g  %14g\n', xmax(1:2) );
  fprintf ( 1, '  Sample minimum =  %14g  %14g\n', xmin(1:2) );

  return
end
