function fly_stats_test ( )

%*****************************************************************************80
%
%% fly_stats_test() tests computes statistics for the fly simulation.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    22 July 2022
%
%  Author:
%
%    John Burkardt
%
  exact = 2.0 / 3.0;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'fly_stats_test():\n' );
  fprintf ( 1, '  A fly lands at random on a plate of radius 1.\n' );
  fprintf ( 1, '  D is the distance from the center.\n' );
  fprintf ( 1, '  The exact average distance is %g\n', exact )
  fprintf ( 1, '  Compute statistics for a sequence of experiments of size n.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  n   dmin dmean dmax dstd ||dmean-exact||\n' );

  for n = [ 10, 100, 1000, 10000 ]
    d = fly_simulation ( n );
    d_min = min ( d );
    d_mean = mean ( d );
    d_max = max ( d );
    d_std = std ( d );
    fprintf ( 1, '  %5d  %6.4f  %6.4f  %6.4f  %6.4f  %6.4f\n', ...
      n, d_min, d_mean, d_max, d_std, abs ( d_mean - exact ) );
  end

  return
end
