function [ gamma, beta, n, tau, t0, y0, tstop ] = mackey_glass_parameters ( ...
  gamma_user, beta_user, n_user, tau_user, t0_user, y0_user, tstop_user )

%*****************************************************************************80
%
%% mackey_glass_parameters() returns parameters for the mackey glass DDE.
%
%  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:
%
%    24 September 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real GAMMA_USER, BETA_USER, N_USER: parameters.
%
%    real TAU_USER: the delay.
%
%    real T0_USER: the initial time.
%
%    real Y0_USER(1): the initial condition.
%
%    real TSTOP_USER: the final time.
%
%  Output:
%
%    real GAMMA, BETA, N: parameters.
%
%    real TAU: the delay.
%
%    real T0: the initial time.
%
%    real Y0(1): the initial condition.
%
%    real TSTOP: the final time.
%
  persistent gamma_default;
  persistent beta_default;
  persistent n_default;
  persistent tau_default;
  persistent t0_default;
  persistent y0_default;
  persistent tstop_default;
%
%  Initialize defaults.
%
  if ( isempty ( gamma_default ) )
    gamma_default = 1.0;
  end

  if ( isempty ( beta_default ) )
    beta_default = 2.0;
  end

  if ( isempty ( n_default ) )
    n_default = 9.65;
  end

  if ( isempty ( tau_default ) )
    tau_default = 2.0;
  end

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

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

  if ( isempty ( tstop_default ) )
    tstop_default = 100.0;
  end
%
%  Update defaults if input was supplied.
%
  if ( 1 <= nargin )
    gamma_default = gamma_user;
  end

  if ( 2 <= nargin )
    beta_default = beta_user;
  end

  if ( 3 <= nargin )
    n_default = n_user;
  end

  if ( 4 <= nargin )
    tau_default = tau_user;
  end

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

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

  if ( 7 <= nargin )
    tstop_default = tstop_user;
  end
%
%  Return values.
%
  gamma = gamma_default;
  beta = beta_default;
  n = n_default;
  tau = tau_default;
  t0 = t0_default;
  y0 = y0_default;
  tstop = tstop_default;
  
  return
end

