function stochastic_rk_test ( )

%*****************************************************************************80
%
%% stochastic_rk_test() tests stochastic_rk().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    21 March 2019
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../stochastic_rk' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'stochastic_rk_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Test stochastic_rk().\n' );

  rng ( 'shuffle' );
%
%  Test rk1_ti_step().
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '  rk1_ti_step() uses a first order RK method\n' );
  fprintf ( 1, '  for a problem whose right hand side does not\n' );
  fprintf ( 1, '  depend explicitly on time.\n' );

  n = 10;
  t0 = 0.0;
  tn = 1.0;
  [ t, x ] = rk1_ti_step_test ( n, t0, tn, fi, gi );
  fprintf ( 1, '\n' );
  fprintf ( 1, '         I           T             X\n' );
  fprintf ( 1, '\n' );
  for i = 1 : n + 1
    fprintf ( 1, '  %8d  %14f  %14e\n', i-1, t(i), x(i) );
  end

  n = 100;
  t0 = 0.0;
  tn = 1.0;
  [ t, x ] = rk1_ti_step_test ( n, t0, tn, fi, gi );
  clf ( );
  plot ( t, x, 'b-', 'linewidth', 2 );
  grid ( 'on' );
  title ( 'stochastic ODE solution via rk1\_ti\_step()' );
  filename = 'rk1_ti_step_test.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'stochastic_rk_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../stochastic_rk' );

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% timestamp() prints the current YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  t = now;
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end

