function simpson_test ( )

%*****************************************************************************80
%
%% simpson_test() applies a composite Simpson rule to finite interval 1D problems.
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    02 September 2022
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'simpson_test():\n' );
  fprintf ( 1, '  Composite Simpson rule,\n' );
  fprintf ( 1, '  for 1D finite interval problems.\n' );

  prob_num = p00_prob_num ( );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Problem       Exact\n' );
  fprintf ( 1, '         Ints   Approx       Error\n' );
%
%  Pick a problem.
%
  for prob = 1 : prob_num
%
%  Some problems have singularities that kill the calculation.
%
    exact = p00_exact ( prob );

    fprintf ( 1, '\n' );
    fprintf ( 1, '  Problem %d\n', prob );
%
%  Pick a number of subintervals.
%
    for int_log = 0 : 15

      int_num = 2^int_log;

      result = p00_simpson ( prob, int_num );

      error = abs ( exact - result );

      fprintf ( 1, ' %7d  %14f  %14e\n', int_num, result, error );

    end

    fprintf ( 1, '  Exact   %14f\n', exact );

  end

  return
end
