function frechet_sample_test ( )

%*****************************************************************************80
%
%% frechet_sample_test() tests frechet_sample().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 September 2008
%
%  Author:
%
%    John Burkardt
%
  sample_num = 1000;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'FRECHET_SAMPLE_TEST():\n' );
  fprintf ( 1, '  FRECHET_MEAN() computes the Frechet mean;\n' );
  fprintf ( 1, '  FRECHET_SAMPLE() samples the Frechet distribution;\n' );
  fprintf ( 1, '  FRECHET_VARIANCE() computes the Frechet variance.\n' );

  alpha = 3.0;

  fprintf ( 1, '\n' );
  fprintf ( 1, '  PDF parameter ALPHA =         %g\n', alpha );

  xmean = frechet_mean ( alpha );
  variance = frechet_variance ( alpha );

  fprintf ( 1, '  PDF mean =                    %g\n', xmean );
  fprintf ( 1, '  PDF variance =                %g\n', variance );

  for i = 1 : sample_num
    x(i) = frechet_sample ( alpha );
  end

  xmean = mean ( x );
  variance = r8vec_variance ( sample_num, x );
  xmax = max ( x );
  xmin = min ( x );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Sample size =     %g\n', sample_num );
  fprintf ( 1, '  Sample mean =     %g\n', xmean );
  fprintf ( 1, '  Sample variance = %g\n', variance );
  fprintf ( 1, '  Sample maximum =  %g\n', xmax );
  fprintf ( 1, '  Sample minimum =  %g\n', xmin );

  return
end
