function expsin_errors ( )

%*****************************************************************************80
%
%% expsin_errors: rk1, rk2, rk4 errors on expsin ODE.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    20 September 2020
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'expsin_errors:\n' );
  fprintf ( 1, '  Solve the expsin ODE using rk1, rk2, rk4.\n' );
  fprintf ( 1, '  Use n = 5, 10, 20, 40, 80 steps.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '    N        rk1        rk2        rk4\n' );
  fprintf ( 1, '\n' );  
  for n = [ 5, 10, 20, 40, 80 ]

    dydt = @ expsin_deriv;
    t0 = 0.0;
    tstop = 10.0;
    tspan = [ t0, tstop ];
    y0 = 1.0;
 
    [ t, y1 ] = rk1 ( dydt, tspan, y0, n );
    [ t, y2 ] = rk2 ( dydt, tspan, y0, n );
    [ t, y4 ] = rk4 ( dydt, tspan, y0, n );
    y = expsin_solution ( t );

    e1 = rms ( y - y1 );
    e2 = rms ( y - y2 );
    e4 = rms ( y - y4 );

    fprintf ( 1, '  %3d  %9.4g  %9.4g  %9.4g\n', n, e1, e2, e4 );

  end

  return
end

