function standing_wave_exact_test ( )

%*****************************************************************************80
%
%% standing_wave_exact_test() tests standing_wave_exact().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    04 April 2025
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../standing_wave_exact' );

  timestamp ( );

  fprintf ( 1, '\n' );
  fprintf ( 1, 'standing_wave_exact_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s:\n', version ( ) );
  fprintf ( 1, '  Test standing_wave_exact(),\n' );
  fprintf ( 1, '  an exact standing wave solution of the wave equation.\n' );
%
%  Report the current parameter values.
%
  [ c, xmin, xmax, t0, tstop ] = standing_wave_parameters ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  parameters:\n' );
  fprintf ( 1, '    c     = %g\n', c );
  fprintf ( 1, '    xmin  = %g\n', xmin );
  fprintf ( 1, '    xmax  = %g\n', xmax );
  fprintf ( 1, '    t0    = %g\n', t0 );
  fprintf ( 1, '    tstop = %g\n', tstop );

  standing_wave_residual_test ( );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'standing_wave_exact_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  timestamp ( );

  rmpath ( '../standing_wave_exact' );

  return
end
function standing_wave_residual_test ( )

%*****************************************************************************80
%
%% standing_wave_residual_test() tests standing_wave_residual().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    04 April 2025
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'standing_wave_residual_test():\n' );
  fprintf ( 1, '  Evaluate solution and residual at selected points (X,T)\n' );
  
  [ c, xmin, xmax, t0, tstop ] = standing_wave_parameters ( );

  n = 11;
  m = 5;
  x = linspace ( xmin, xmax, n );
  t = linspace ( t0, tstop, m );

  fprintf ( 1, '\n' );
  fprintf ( 1, '      X       T       U(X,T)      Resid(X,T)\n' );
  fprintf ( 1, '\n' );
  for j = 1 : m
    for i = 1 : n
      [ u, ut, utt, ux, uxx ] = standing_wave_exact ( x(i), t(j) );
      r = standing_wave_residual ( x(i), t(j) );
      fprintf ( 1, '  %8.4f  %8.4f  %10.4g  %g\n', x(i), t(j), u, r );
    end
    fprintf ( 1, '\n' );
  end

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% timestamp() prints the current YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  t = now;
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end

