function annulus_distance_test ( )

%*****************************************************************************80
%
%% annulus_distance_test() tests annulus_distance().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    08 August 2022
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../annulus_distance' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'annulus_distance_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s.\n', version ( ) );
  fprintf ( 1, '  Test annulus_distance()\n' );

  n = 10000;
  pc = [ 0.0, 0.0 ];
  r2 = 1.0;
  for r1 = [ 0.0, 0.1, 0.2, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 0.99 ]
    [ mu, var ] = annulus_distance_stats ( n, pc, r1, r2 );
    fprintf ( 1, '\n' );
    fprintf ( 1, '  Using N = %d sample points,\n', n );
    fprintf ( 1, '  R1 = %g, R2 = %g\n', r1, r2 );
    fprintf ( 1, '  Estimated mean distance = %g\n', mu );
    fprintf ( 1, '  Estimated variance      = %g\n', var );
  end

  fprintf ( 1, '\n' );

  n = 10000;
  pc = [ 0.0, 0.0 ];
  r2 = 1.0;
  for r1 = [ 0.0, 0.1, 0.2, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 0.90, 0.99 ]
    annulus_distance_histogram ( n, pc, r1, r2 );
    filename = sprintf ( 'annulus_distance_histogram_%g_%g.png', r1, r2 );
    print ( '-dpng', filename );
    fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  end
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'annulus_distance_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../annulus_distance' );

  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

