function convergence_n_test02 ( )

%*****************************************************************************80
%
%% convergence_n_test02() tests convergence_n() on a set of 6 results.
%
%  Discussion:
%
%    The solution method is presumable of order 2.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    10 September 2024
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'convergence_n_test02():\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 = 6;
  n = [ 4,           8,           16,          32,          64,          128 ];
  e = [ 6.05759e-05, 2.04755e-05, 5.66053e-06, 1.47327e-06, 3.74947e-07, 9.45143e-08 ];

  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 estimates.
%
  eoc = convergence_n ( n, e );

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

  fprintf ( 1, '\n' );
  fprintf ( 1, '    n(k)  error(k)   eoc(k)\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
