function stats_test ( )

%*****************************************************************************80
%
%% stats_test() tests stats().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    05 May 2021
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../persistence' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'stats_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Test stats(), with the interface:\n' );
  fprintf ( 1, '    [n,sum,min,mean,max,var,std] = stats(x)\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '    Call 10 times with random values;\n' );
  fprintf ( 1, '    Compare results with MATLAB vector calculation.\n' );

  n = 10;
  x = rand ( n, 1 );

  stats ( );
  for i = 1 : n
    stats ( x(i) );
  end
  [ n, x_sum, x_min, x_mean, x_max, x_var, x_std ] = stats ( Inf );

  fprintf ( 1, '\n' );
  fprintf ( 1, '      n1    = %d, n2    = %d\n', n,      size ( x, 1 ) );
  fprintf ( 1, '      sum1  = %g, sum2  = %g\n', x_sum,  sum ( x ) );
  fprintf ( 1, '      min1  = %g, min2  = %g\n', x_min,  min ( x ) );
  fprintf ( 1, '      mean1 = %g, mean2 = %g\n', x_mean, mean ( x ) );
  fprintf ( 1, '      max1  = %g, max2  = %g\n', x_max,  max ( x ) );
  fprintf ( 1, '      var1  = %g, var2  = %g\n', x_var,  var ( x ) );
  fprintf ( 1, '      std1  = %g, std2  = %g\n', x_std,  std ( x ) );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'stats_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../persistence' );

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% timestamp() prints the current YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  t = now;
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end

