function [ g, k, l, m, t0, y0, tstop ] = pendulum_elastic_parameters ( ...
  g_user, k_user, l_user, m_user, t0_user, y0_user, tstop_user )

%*****************************************************************************80
%
%% pendulum_elastic_parameters(): parameters for the elastic pendulum 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:
%
%    24 April 2021
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Paul D Williams,
%    The RAW Filter: An Improvement to the Robert–Asselin Filter 
%    in Semi-Implicit Integrations,
%    Monthly Weather Review,
%    Volume 139, pages 1996-2007, June 2011.
%
%  Input:
%
%    real G_USER: the gravitational constant, in meter / second^2;
%
%    real K_USER: the spring constant, in Newton / meter 
%    = kilogram meter / second^2.
%
%    real L_USER: the pendulum length, in meters;
%
%    real M_USER: the pendulum mass, in kilograms.
%
%    real T0_USER: the initial time, in seconds;
%
%    real Y0_USER(4): the initial values, in radians, and radians per second,
%    units and units per second.
%
%    real TSTOP_USER: the final time, in seconds.
%
%  Output:
%
%    real G: the gravitational constant, in meter / second^2;
%
%    real K: the spring constant, in Newton / meter = kilogram meter / second^2.
%
%    real L: the pendulum length, in meters;
%
%    real M: the pendulum mass, in kilograms.
%
%    real T0: the initial time, in seconds;
%
%    real Y0(4): the initial values, in radians, and radians per second,
%    units and units per second.
%
%    real TSTOP: the final time, in seconds.
%
  persistent g_default;
  persistent k_default;
  persistent l_default;
  persistent m_default;
  persistent t0_default;
  persistent y0_default;
  persistent tstop_default;
%
%  Initialize defaults.
%
  if ( isempty ( g_default ) )
    g_default = 9.81;
  end

  if ( isempty ( k_default ) )
    k_default = 100.0;
  end

  if ( isempty ( l_default ) )
    l_default = 1.0;
  end

  if ( isempty ( m_default ) )
    m_default = 0.1;
  end

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

  if ( isempty ( y0_default ) )
    y01 = 1.0;
    y02 = 0.0;
    y03 = 0.01;
    y04 = 0.0;
    y0_default = [ y01, y02, y03, y04 ];
  end

  if ( isempty ( tstop_default ) )
    tstop_default = 10.0;
  end
%
%  Update defaults if input was supplied.
%
  if ( 1 <= nargin )
    g_default = g_user;
  end

  if ( 2 <= nargin )
    k_default = k_user;
  end

  if ( 3 <= nargin )
    l_default = l_user;
  end

  if ( 4 <= nargin )
    m_default = m_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.
%
  g = g_default;
  k = k_default;
  l = l_default;
  m = m_default;
  t0 = t0_default;
  y0 = y0_default;
  tstop = tstop_default;

  return
end

