function laplace_radial_exact_test ( )

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

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

  n = 5;
  X = rand ( n, 1 );
  Y = rand ( n, 1 );
  Z = rand ( n, 1 );
  a = 1.0;
  b = 2.0;
  c = 3.0;
%
%  2D case.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Radial solution in 2D:\n' );

  [ U, Ux, Uy, Uxx, Uxy, Uyy ] = laplace_radial_2d_exact ( X, Y, a, b );
  R = Uxx + Uyy;

  fprintf ( 1, '  RMS norm of residuals = %g\n', r8vec_norm_rms ( R ) );
%
%  3D case.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Radial solution in 3D:\n' );

  [ U, Ux, Uy, Uz, Uxx, Uxy, Uxz, Uyy, Uyz, Uzz ] = ...
    laplace_radial_3d_exact ( X, Y, Z, a, b );
  R = Uxx + Uyy + Uzz;

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

  rmpath ( '../laplace_radial_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

