function hyperball_distance_test ( )

%*****************************************************************************80
%
%% HYPERBALL_DISTANCE_TEST tests HYPERBALL_DISTANCE.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    21 January 2019
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../hyperball_distance' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'HYPERBALL_DISTANCE_TEST:\n' );
  fprintf ( 1, '  MATLAB version\n' );
  fprintf ( 1, '  Test HYPERBALL_DISTANCE.\n' );

  m = 20;
  n = 10000;
  [ mu, var ] = hyperball_distance_stats ( m, n );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Using M = %d spatial dimension.\n', m );
  fprintf ( 1, '  Using N = %d sample points,\n', n );
  fprintf ( 1, '  Estimated mean distance = %g\n', mu );
  fprintf ( 1, '  Estimated variance      = %g\n', var );

  n = 10000;
  hyperball_distance_histogram ( m, n );
  filename = 'hyperball_distance_histogram.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics saved in "%s"\n', filename );

  hyperball_distance_pdf ( m );
  filename = 'hyperball_distance_pdf.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics saved in "%s"\n', filename );

  clf
  hold on
  n = 10000;
  hyperball_distance_histogram ( m, n );
  hyperball_distance_pdf ( m );
  hold off
  filename = 'hyperball_distance_compare.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics saved in "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'HYPERBALL_DISTANCE_TEST:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../hyperball_distance' );

  return
end
