function [ C, t0, y0, tstop ] = gear_parameters ( C_user, t0_user, y0_user, ...
  tstop_user )

%*****************************************************************************80
%
%% gear_parameters() returns parameters of gear_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:
%
%    08 June 2026
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real C_USER(2,2): the coefficient matrix for the derivative.
%
%    real T0_USER: the initial time.
%
%    real Y0_USER(2): the initial condition.
%
%    real TSTOP_USER: the final time.
%
%  Output:
%
%    real C(2,2): the coefficient matrix for the derivative.
%
%    real T0: the initial time.
%
%    real Y0(2): the initial condition.
%
%    real TSTOP: the final time.
%
  persistent C_default;
  persistent t0_default;
  persistent y0_default;
  persistent tstop_default;
%
%  Initialize defaults.
%
  if ( isempty ( C_default ) )
    C_default = [ - 998.0, - 1998; ...
                  + 999.0, + 1999 ];
  end

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

  if ( isempty ( y0_default ) )
    y1 = 1.0;
    y2 = 0.0;
    y0_default = [ y1, y2 ];
  end

  if ( isempty ( tstop_default ) )
    tstop_default = 2.0;
  end
%
%  Update defaults if input was supplied.
%
  if ( 1 <= nargin )
    C_default = C_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.
%
  C = C_default;
  t0 = t0_default;
  y0 = y0_default;
  tstop = tstop_default;

  return
end

