function poisson_2d_exact_test ( )

%*****************************************************************************80
%
%% poisson_2d_exact_test() tests poisson_2d_exact().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    05 June 2025
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../poisson_2d_exact' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'poisson_2d_exact_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Test poisson_2d_exact().\n' );

  n = 5;
  X = rand ( n, 1 );
  Y = rand ( n, 1 );

  [ U, Ux, Uy, Uxx, Uxy, Uyy ] = poisson_2d_exact ( X, Y );
  F = zeros ( n, 1 );
  R = Uxx + Uyy + F;

  fprintf ( 1, '  RMS norm of residuals = %g\n', r8vec_norm_rms ( R ) );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'poisson_2d_exact_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../poisson_2d_exact' );

  return
end
function value = r8vec_norm_rms ( a )

%*****************************************************************************80
%
%% r8vec_norm_rms() returns the RMS norm of an R8VEC.
%
%  Discussion:
%
%    The vector RMS norm is defined as:
%
%      value = sqrt ( sum ( 1 <= I <= N ) A(I)^2 / N ).
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    26 October 2011
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real A(N), the vector.
%
%  Output:
%
%    real VALUE, the RMS norm.
%
  n = length ( a );

  value = sqrt ( sum ( a(1:n).^2 ) / n );

  return
end
function timestamp ( )

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

  return
end

