function [ g, m1, m2, l1, l2, t0, y0, tstop ] = ...
  pendulum_double_parameters ( g_user, m1_user, m2_user, l1_user, l2_user, ...
  t0_user, y0_user, tstop_user )

%*****************************************************************************80
%
%% pendulum_double_parameters(): parameters for pendulum_double_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:
%
%    02 May 2021
%
%  Author:
%
%    John Burkardt
%
%  Output:
%
%    real G_USER: the gravitational force coefficient.
%
%    real M1_USER, M2_USER: the masses of pendulums 1 and 2.
%
%    real L1_USER, L2_USER: the lengths of pendulums 1 and 2.
%
%    real T0_USER: the initial time.
%
%    real Y0_USER[4]: the initial condition.
%
%    real TSTOP_USER: the final time.
%
%  Input:
%
%    real G: the gravitational force coefficient.
%
%    real M1, M2: the masses of pendulums 1 and 2.
%
%    real L1, L2: the lengths of pendulums 1 and 2.
%
%    real T0: the initial time.
%
%    real Y0[4]: the initial condition.
%
%    real TSTOP: the final time.
%
  persistent g_default;
  persistent m1_default;
  persistent m2_default;
  persistent l1_default;
  persistent l2_default;
  persistent t0_default;
  persistent y0_default;
  persistent tstop_default;
%
%  Initialize defaults.
%
  if ( isempty ( g_default ) )
    g_default = 9.81;
  end

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

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

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

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

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

  if ( isempty ( y0_default ) )
    y0_default = [ 0.25, 0.0, 0.0, 0.0 ];
  end

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

  if ( 2 <= nargin )
    m1_default = m1_user;
  end

  if ( 3 <= nargin )
    m2_default = m2_user;
  end

  if ( 4 <= nargin )
    l1_default = l1_user;
  end

  if ( 5 <= nargin )
    l2_default = l2_user;
  end

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

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

  if ( 8 <= nargin )
    tstop_default = tstop_user;
  end
%
%  Return values.
%
  g = g_default;
  m1 = m1_default;
  m2 = m2_default;
  l1 = l1_default;
  l2 = l2_default;
  t0 = t0_default;
  y0 = y0_default;
  tstop = tstop_default;
  
  return
end

