function frechet_sample_test ( ) %*****************************************************************************80 % %% FRECHET_SAMPLE_TEST tests FRECHET_SAMPLE. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 03 September 2008 % % Author: % % John Burkardt % sample_num = 1000; seed = 123456789; 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 ); mean = frechet_mean ( alpha ); variance = frechet_variance ( alpha ); fprintf ( 1, ' PDF mean = %g\n', mean ); fprintf ( 1, ' PDF variance = %g\n', variance ); for i = 1 : sample_num [ x(i), seed ] = frechet_sample ( alpha, seed ); end mean = r8vec_mean ( sample_num, x ); variance = r8vec_variance ( sample_num, x ); [ xmax, imax ] = r8vec_max ( sample_num, x ); [ xmin, imin ] = r8vec_min ( sample_num, x ); fprintf ( 1, '\n' ); fprintf ( 1, ' Sample size = %g\n', sample_num ); fprintf ( 1, ' Sample mean = %g\n', mean ); fprintf ( 1, ' Sample variance = %g\n', variance ); fprintf ( 1, ' Sample maximum = %g\n', xmax ); fprintf ( 1, ' Sample minimum = %g\n', xmin ); return end