function [ m, n, t0, y0, tstop ] = doughnut_parameters ( ...
  m_user, n_user, t0_user, y0_user, tstop_user )

%*****************************************************************************80
%
%% doughnut_parameters() returns parameters for doughnut_ode().
%
%  Discussion:
%
%    If input values are specified, this resets the default parameters.
%    Otherwise, the output will be the current defaults.
%
%    Suggested choices for m, n, (y0) include:
%
%      3,  5, (1, 1, 3.0)
%      4,  5, (1, 1, 0.3)
%      pi, 5, (1, 1, 0.3)
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    09 October 2025
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real m_user, n_user: problem parameters.
%
%    real t0_user: the initial time.
%
%    real y0_user(3): the initial condition.
%
%    real tstop_user: the final time.
%
%  output:
%
%    real m, n: problem parameters.
%
%    real t0: the initial time.
%
%    real y0(3): the initial condition.
%
%    real tstop: the final time.
%
  persistent m_default;
  persistent n_default;
  persistent t0_default;
  persistent y0_default;
  persistent tstop_default;
%
%  Initialize defaults.
%
  if ( isempty ( m_default ) )
    m_default = 3.0;
  end

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

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

  if ( isempty ( y0_default ) )
    y0_default = [ 1.0, 1.0, 3.0 ];
  end

  if ( isempty ( tstop_default ) )
    tstop_default = 40.0;
  end
%
%  Update defaults if input was supplied.
%
  if ( 1 <= nargin )
    m_default = m_user;
  end

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

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

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

  if ( 5 <= nargin )
    tstop_default = tstop_user;
  end
%
%  Return values.
%
  m = m_default;
  n = n_default;
  t0 = t0_default;
  y0 = y0_default;
  tstop = tstop_default;
  
  return
end

