function [ e, lam, t0, y0, tstop ] = henon_heiles_parameters ( ...
  e_user, lam_user, t0_user, y0_user, tstop_user )

%*****************************************************************************80
%
%% henon_heiles_parameters() returns parameters for henon_heiles_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:
%
%    23 April 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real E_USER: the initial energy.
%
%    real LAM_USER: a parameter.
%
%    real T0_USER: the initial time.
%
%    real Y0_USER(4): the initial condition.
%
%    real TSTOP_USER: the final time.
%
%  Output:
%
%    real E: the initial energy.
%
%    real LAM: a parameter.
%
%    real T0: the initial time.
%
%    real Y0(4): the initial condition.
%
%    real TSTOP: the final time.
%
  persistent e_default;
  persistent lam_default;
  persistent t0_default;
  persistent y0_default;
  persistent tstop_default;
%
%  Initialize defaults.
%
  if ( isempty ( e_default ) )
    e_default = 0.05;
  end

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

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

  if ( isempty ( y0_default ) )
    e = e_default;
    lam = lam_default;
    t0 = t0_default;
    u = 0.0;
    v = 0.0;
    vp = 0.0;
    y0_default = henon_heiles_initial ( e, lam, t0, u, v, vp );
  end

  if ( isempty ( tstop_default ) )
    tstop_default = 10000.0;
  end
%
%  Update defaults if input was supplied.
%
  if ( 1 <= nargin )
    e_default = e_user;
  end

  if ( 2 <= nargin )
    lam_default = lam_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.
%
  e = e_default;
  lam = lam_default;
  t0 = t0_default;
  y0 = y0_default;
  tstop = tstop_default;
  
  return
end

