function [ a, k, w, phi, xmin, xmax, t0, tstop ] = ...
  traveling_wave_parameters ( a_user, k_user, w_user, phi_user, ...
  xmin_user, xmax_user, t0_user, tstop_user )

%*****************************************************************************80
%
%% traveling_wave_parameters() returns parameters for the traveling wave equation.
%
%  Discussion:
%
%    d^2u/dt^2 = c^2 d^2u/dx^2
%
%    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:
%
%    09 April 2025
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real a_user: the amplitude.
%
%    real k_user: the wave number.
%
%    real w_user: angular frequency.
%
%    real phi_user: the phase angle.
%
%    real xmin_user, xmax_user: the left and right interval endpoints.
%
%    real t0_user: the initial time.
%
%    real tstop_user: the final time.
%
%  Output:
%
%    real a: the amplitude.
%
%    real k: the wave number.
%
%    real w: angular frequency.
%
%    real phi: the phase angle.
%
%    real xmin, xmax: the left and right interval endpoints.
%
%    real t0: the initial time.
%
%    real tstop: the final time.
%
  persistent a_default;
  persistent k_default;
  persistent w_default;
  persistent phi_default;
  persistent t0_default;
  persistent tstop_default;
  persistent xmax_default;
  persistent xmin_default;
%
%  Initialize defaults.
%
  if ( isempty ( a_default ) )
    a_default = 2.0;
  end

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

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

  if ( isempty ( phi_default ) )
    phi_default = pi / 4.0;
  end

  if ( isempty ( xmin_default ) )
    xmin_default = -1.0;
  end

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

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

  if ( isempty ( tstop_default ) )
    tstop_default = 5.0;
  end
%
%  Update defaults if input was supplied.
%
  if ( 1 <= nargin )
    a_default = a_user;
  end

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

  if ( 3 <= nargin )
    w_default = w_user;
  end

  if ( 4 <= nargin )
    phi_default = phi_user;
  end

  if ( 5 <= nargin )
    xmin_default = xmin_user;
  end

  if ( 6 <= nargin )
    xmax_default = xmax_user;
  end

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

  if ( 8 <= nargin )
    tstop_default = tstop_user;
  end
%
%  Return values.
%
  a = a_default;
  k = k_default;
  w = w_default;
  phi = phi_default;
  xmin = xmin_default;
  xmax = xmax_default;
  t0 = t0_default;
  tstop = tstop_default;

  return
end

