function [ m0, m1, m2, t0, y0, tstop ] = three_body_parameters ( m0_user, ...
  m1_user, m2_user, t0_user, y0_user, tstop_user )

%*****************************************************************************80
%
%% three_body_parameters() returns parameters for three_body_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:
%
%    26 April 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real M0_USER, M1_USER, M2_USER: the masses of the three bodies.
%
%    real T0_USER: the initial time.
%
%    real Y0_USER(12): the initial condition.
%
%    real TSTOP_USER: the final time.
%
%  Output:
%
%    real M0, M1, M2: the masses of the three bodies.
%
%    real T0: the initial time.
%
%    real Y0(12): the initial condition.
%
%    real TSTOP: the final time.
%
  persistent m0_default;
  persistent m1_default;
  persistent m2_default;
  persistent t0_default;
  persistent y0_default;
  persistent tstop_default;
%
%  Initialize defaults.
%
  if ( isempty ( m0_default ) )
    m0_default = 5.0;
  end

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

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

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

  if ( isempty ( y0_default ) )
    y0_default = [ ...
     1.0, -1.0,  0.0,  0.0, ...
     1.0,  3.0,  0.0,  0.0, ...
    -2.0, -1.0,  0.0,  0.0 ];
  end

  if ( isempty ( tstop_default ) )
    tstop_default = 63.0;
  end
%
%  Update defaults if input was supplied.
%
  if ( 1 <= nargin )
    m1_default = m1_user;
  end

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

  if ( 3 <= nargin )
    m3_default = m3_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.
%
  m0 = m0_default;
  m1 = m1_default;
  m2 = m2_default;
  t0 = t0_default;
  y0 = y0_default;
  tstop = tstop_default;
  
  return
end

