function [ k, t0, y0, tstop ] = reaction_parameters ( k_user, t0_user, ...
  y0_user, tstop_user )

%*****************************************************************************80
%
%% reaction_parameters() returns parameters for the reaction ODE.
%
%  Discussion:
%
%    If input values are specified, this resets the default parameters.
%    Otherwise, the output will be the current defaults.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    25 April 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real K_USER: the reaction rate.
%
%    real T0_USER: the initial time, in seconds.
%
%    real Y0_USER[3]: the initial condition, in Mol/L.
%
%    real TSTOP_USER: the final time, in seconds.
%
%  Output:
%
%    real K: the reaction rate.
%
%    real T0: the initial time, in seconds.
%
%    real Y0[3]: the initial condition, in Mol/L.
%
%    real TSTOP: the final time, in seconds.
%
  persistent k_default;
  persistent t0_default;
  persistent y0_default;
  persistent tstop_default;
%
%  Initialize defaults.
%
  if ( isempty ( k_default ) )
    k_default = 0.02;
  end

  if ( isempty ( t0_default ) )
    t0_default = 0.0;
  end

  if ( isempty ( y0_default ) )
    a0 = 10.0;
    b0 = 12.0;
    c0 = 3.0;
    y0_default = [ a0; b0; c0 ];
  end

  if ( isempty ( tstop_default ) )
    tstop_default = 20.0;
  end
%
%  Update defaults if input was supplied.
%
  if ( 1 <= nargin )
    k_default = k_user;
  end

  if ( 2 <= nargin )
    t0_default = t0_user;
  end

  if ( 3 <= nargin )
    y0_default = y0_user;
  end

  if ( 4 <= nargin )
    tstop_default = tstop_user;
  end
%
%  Return values.
%
  k = k_default;
  t0 = t0_default;
  y0 = y0_default;
  tstop = tstop_default;
  return
end

