function convergence_n_test01 ( )

%*****************************************************************************80
%
%% convergence_n_test01() tests convergence_n() on a set of 7 results.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    10 September 2024
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'convergence_n_test01():\n' );
  fprintf ( 1, '  A computation has been carried out with n=2^k intervals,\n' );
  fprintf ( 1, '  where n = 8, 16, ..., 512, and for each n, the\n' );
  fprintf ( 1, '  approximation error e(n) was computed.\n' );
  fprintf ( 1, '  convergence_n() estimates the convergence order.\n' );

  nn = 7;
  n = [ 8,        16,       32,       64,       128,      256,      512 ];
  e = [ 1.17e-02, 1.76e-04, 9.94e-05, 2.40e-06, 2.02e-07, 6.46e-09, 3.07e-10 ];

  fprintf ( 1, '\n' );
  fprintf ( 1, '  The number of computations was %d\n', nn );
  fprintf ( 1, '  The size n = 2^k was\n' );
  disp ( n );
  fprintf ( 1, '  The errors e(n):\n' );
  disp ( e );
%
%  Request convergence order estimates.
%
  eoc = convergence_n ( n, e );

  eoc_mean = mean ( eoc(2:end) );

  fprintf ( 1, '\n' );
  fprintf ( 1, '    n(k)  error(k)   eoc\n' );
  fprintf ( 1, '\n' );
  for k = 1 : nn
    fprintf ( 1, '  %3d  %.2e  %.2f\n', n(k), e(k), eoc(k) );
  end
  fprintf ( 1, '\n' );
  fprintf ( 1, '  eoc mean       %.2f\n', eoc_mean );

  return
end
