function rk12_adapt_expsin_test ( )

%*****************************************************************************80
%
%% rk12_adapt_expsin_test tests rk12_adapt on the expsin problem.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    09 April 2020
%
%  Author:
%
%    John Burkardt
%
  f = @ expsin_deriv;
  tspan = [ 0.0, 10.0 ];
  y0 = 1.0;
  dt = 0.1;
  tol = 0.75;
 
  [ t, y ] = rk12_adapt ( f, tspan, y0, dt, tol );

  n = length ( t );
  fprintf ( 1, '  Number of steps taken: %d\n', n );

  e = y - expsin_exact ( t );

  tex = linspace ( t(1), t(end), 101 );
  yex = expsin_exact ( tex );

  fprintf ( 1, '  Norm of error: %g\n', norm ( e ) );

  clf ( );
  hold ( 'on' );
  plot ( tex, yex, 'b-', 'linewidth', 3 );
  plot ( t, y, 'r.', 'markersize', 25 );
  plot ( t, e, 'g', 'linewidth', 3 );
  hold ( 'off' );
  grid ( 'on' );
  xlabel ( '<--- T --->' );
  ylabel ( '<--- Y(T) --->' );
  legend ( 'Exact', 'Estimate', 'Error' );
  filename = 'rk12_adapt_expsin_test.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  return
end

