function r = kdv_residual ( u, ut, ux, uxxx )

%*****************************************************************************80
%
%% kdv_residual(): evaluate the residual of KDV PDE.
%
%  Discussion:
%
%    The residual of the Korteweg-Devries PDE:
%      u' - 6 u ux + uxxx
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    04 November 2023
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    John D Cook,
%    Solitons and the KdV equation,
%    03 November 2023,
%    https://www.johndcook.com/blog/2023/11/03/solitons-and-the-kdv-equation/
%
%  Input:
%
%    real u, ut, ux, uxxx:
%    the values of the solution and its derivatives.
%
%  Output:
%
%    real r: the residual.

  r = ut - 6.0 * u .* ux + uxxx;

  return
end

