function [ n, force, perturb, t0, y0, tstop ] = lorenz96_parameters ( ...
  n_user, force_user, perturb_user, t0_user, y0_user, tstop_user )

%*****************************************************************************80
%
%% lorenz96_parameters() returns parameters for lorenz96_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:
%
%    29 September 2025
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real n_user, force_user, perturb_user: problem parameters.
%
%    real t0_user: the initial time.
%
%    real y0_user(n): the initial condition.
%
%    real tstop_user: the final time.
%
%  Output:
%
%    real n, force, perburb: problem parameters.
%
%    real t0: the initial time.
%
%    real y0(n): the initial condition.
%
%    real tstop: the final time.
%
  persistent n_default;
  persistent force_default;
  persistent perturb_default;
  persistent t0_default;
  persistent y0_default;
  persistent tstop_default;
%
%  Initialize defaults.
%
  if ( isempty ( n_default ) )
    n_default = 4;
  end

  if ( isempty ( force_default ) )
    force_default = 8.0;
  end

  if ( isempty ( perturb_default ) )
    perturb_default = 0.001;
  end

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

  if ( isempty ( y0_default ) )
    s = perturb_default * randn ( 1, n_default );
    y0_default = force_default * ones ( 1, n_default ) + s;
  end

  if ( isempty ( tstop_default ) )
    tstop_default = 30.0;
  end
%
%  Update defaults if input was supplied.
%
  if ( 1 <= nargin )
    n_default = n_user;
  end

  if ( 2 <= nargin )
    force_default = force_user;
  end

  if ( 3 <= nargin )
    perturb_default = perturb_user;
  end

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

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

  if ( 6 <= nargin )
    tstop_default = tstop_user;
  end
%
%  Return values.
%
  n = n_default;
  force = force_default;
  perturb = perturb_default;
  t0 = t0_default;
  y0 = y0_default;
  tstop = tstop_default;
  
  return
end

