function reaction_twoway_ode_test ( )

%*****************************************************************************80
%
%% reaction_twoway_ode_test() solves the two-way reaction ODE.
%
%  Discussion:
%
%    The reference suggests an experiment in which the Forward Euler method
%    is used, with a timestep of 1/50.  The problem is to be solved three
%    times, with the second reaction coefficient, k2, set to 10 (the default), 
%    100, and 1000.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    25 April 2021
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Willem Hundsdorfer, Jan Verwer,
%    Numerical solution of time-dependent advection-diffusion-reaction equations,
%    Springer, 2003
%    ISBN: 978-3-662-09017-6
%
  addpath ( '../reaction_twoway_ode' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'reaction_twoway_ode_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Solve the two-way reaction ODE.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Reaction differential equation:\n' );
  fprintf ( 1, '    dW1/dt = - k1 W1 + k2 W2\n' );
  fprintf ( 1, '    dW2/dt = + k1 W1 - k2 W2\n' );
%
%  Get parameter values.
%
  [ k1, k2, t0, y0, tstop ] = reaction_twoway_parameters ( );
%
%  Report parameter values.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Parameter values:\n' );
  fprintf ( 1, '    k1    = %g, (reaction rate)\n', k1 );
  fprintf ( 1, '    k2    = %g, (reaction rate)\n', k2 );
  fprintf ( 1, '    t0    = %g, (initial time, in seconds s)\n', t0 );
  fprintf ( 1, '    w10   = %g, (initial amount of species W1)\n', y0(1) );
  fprintf ( 1, '    w20   = %g, (initial amount of species W2)\n', y0(2) );
  fprintf ( 1, '    tstop = %g, (final time, in seconds s)\n', tstop );
%
%  Call the solvers.
%
  n = 51;
  reaction_twoway_euler ( n );

  n = 51;
  reaction_twoway_midpoint ( n );

  reaction_twoway_ode45 ( );

  n = 51;
  reaction_twoway_trapezoidal ( n );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'reaction_twoway_ode_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../reaction_twoway_ode' );

  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

