function ode_midpoint_test ( )

%*****************************************************************************80
%
%% ode_midpoint_test tests ode_midpoint.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    31 July 2019
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../ode_midpoint' );

  timestamp ( );
  fprintf ( 1, 'ode_midpoint_test:\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Test ode_midpoint\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  ode_midpoint is an interactive program which uses\n' );
  fprintf ( 1, '  the midpoint method to estimate the solution of\n' );
  fprintf ( 1, '  an ordinary differential equation (ODE) of the form\n' );
  fprintf ( 1, '    y'' = f(x,y)\n' )
  fprintf ( 1, '  for a <= x <= b, with initial condition y(a)=ya\n' );
  fprintf ( 1, '  using n steps.\n' );
%
%  Use a coarse grid.
%
  a = 0.0;
  b = 1.0;
  ya = 0.0;
  n = 10;
  [ xp, yp ] = ode_midpoint ( 'stiff_deriv(x,y)', a, b, ya, n );

  ne = 101;
  xe = linspace ( a, b, ne );
  xe = xe';
  ye = stiff_solution ( xe );

  plot ( xe, ye, 'b-', xp, yp, 'r-', 'linewidth', 3 );
  grid ( 'on' );
  xlabel ( '<-- X -->' );
  ylabel ( '<-- Y -->' );
  label = sprintf ( 'Midpoint solution using %d steps', n );
  title ( label );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'ode_midpoint_test:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  timestamp ( );

  rmpath ( '../ode_midpoint' );

  return
end
