function r = porous_medium_residual ( t, x )

%*****************************************************************************80
%
%% porous_medium_residual() computes the residual of the porous medium equation.
%
%  Discussion:
%
%    ut = Del^2 ( u^m )
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    19 May 2024
%
%  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.
%
  [ c, delta, m, t0, tstop ] = porous_medium_parameters ( );

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

  r = ut - m * ( m - 1 ) * u^(m-2) * ux^2 - m * u^(m-1) * uxx;

  return
end
