function r = traveling_wave_residual ( t, x )

%*****************************************************************************80
%
%% traveling_wave_residual() computes the residual of the traveling wave equation.
%
%  Discussion:
%
%    d^2u/dt^2 = c^2 d^2u/dx^2
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    09 April 2025
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real T, X: the time and position where the solution is evaluated.
%
%  Output:
%
%    real R: the residual at that time and position.
%
  [ a, k, w, phi, xmin, xmax, t0, tstop ] = traveling_wave_parameters ( );

  [ u, ut, utt, ux, uxx ] = traveling_wave_exact ( t, x );

  c = w / k;

  r = utt - c^2 * uxx;

  return
end
