function rk4_step_test ( )

%*****************************************************************************80
%
%% rk4_step_test tests rk4_step on a scalar ODE.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license. 
%
%  Modified:
%
%    09 October 2013
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'rk4_step_test\n' );
  fprintf ( 1, '  rk4_step takes one Runge-Kutta step for a scalar ODE.\n' );

  fprintf ( 1, '\n' );
  fprintf ( 1, '          T          U(T)\n' );
  fprintf ( 1, '\n' );

  dt = 0.1;
  t0 = 0.0;
  tmax = 12.0 * pi;
  u0 = 0.5;

  t_num = floor ( 1 + ( tmax - t0 ) / dt );

  t = zeros ( t_num, 1 );
  u = zeros ( t_num, 1 );

  i = 1;
  t(i) = t0;
  u(i) = u0;

  while ( true )
%
%  Print (T0,U0).
%
    fprintf ( 1, '  %g  %g\n', t0, u0 );
%
%  Stop if we've exceeded TMAX.
%
    if ( tmax <= t0 )
      break
    end
%
%  Otherwise, advance to time T1, and have RK4 estimate 
%  the solution U1 there.
%
    t1 = t0 + dt;
    u1 = rk4_step ( t0, u0, dt, @rk4_step_test_f );

    i = i + 1;
    t(i) = t1;
    u(i) = u1;
%
%  Shift the data to prepare for another step.
%
    t0 = t1;
    u0 = u1;

  end

  return
end
