function simpson_test ( )

%*****************************************************************************80
%
%% simpson_test tests simpson.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    20 June 2019
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'simpson_test:\n' );
  fprintf ( 1, '  MATLAB version\n' );
  fprintf ( 1, '  Test simpson():\n' );

  a = 0.0;
  b = 1.0;
  n0 = 2;
  index_f = 1;
  exact = 0.746824132812427;
  [ integral, difference, ratio ] = simpson ( a, b, n0, index_f );
  fprintf ( 1, '  #1  Exact = %g, Estimate = %g, Difference = %g\n', exact, integral(end), abs ( exact - integral(end) ) );

  a = 0.0;
  b = 4.0;
  n0 = 2;
  index_f = 2;
  exact = 1.32581766366803;
  [ integral, difference, ratio ] = simpson ( a, b, n0, index_f );
  fprintf ( 1, '  #2  Exact = %g, Estimate = %g, Difference = %g\n', exact, integral(end), abs ( exact - integral(end) ) );

  a = 0.0;
  b = 2.0 * pi;
  n0 = 2;
  index_f = 3;
  exact = 3.62759872846844;
  [ integral, difference, ratio ] = simpson ( a, b, n0, index_f );
  fprintf ( 1, '  #3  Exact = %g, Estimate = %g, Difference = %g\n', exact, integral(end), abs ( exact - integral(end) ) );

  a = - pi;
  b = pi;
  n0 = 2;
  index_f = 4;
  exact = 7.95492652101284;
  [ integral, difference, ratio ] = simpson ( a, b, n0, index_f );
  fprintf ( 1, '  #4  Exact = %g, Estimate = %g, Difference = %g\n', exact, integral(end), abs ( exact - integral(end) ) );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'simpson_test:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end

