function laplacian5_torus_test ( )

%*****************************************************************************80
%
%% laplacian5_torus_test() tests laplacian5_torus().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    28 June 2020
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'laplacian5_torus_test():\n' );
  fprintf ( 1, '  laplacian5_torus() approximates the Laplacian operator\n' );
  fprintf ( 1, '  applied to a function on a 2D torus.\n' );
  fprintf ( 1, '\n' );

  for p = [ 1, 2, 4 ]

    nx = 5 * p;
    xmin = 0.0;
    xmax = 2.0 * pi;
    x = linspace ( xmin, xmax, nx );
    dx = ( xmax - xmin ) / ( nx - 1 );

    ny = 5 * p;
    ymin = - pi;
    ymax = + pi;
    y = linspace ( ymin, ymax, ny );
    dy = ( ymax - ymin ) / ( ny - 1 );

    [ X, Y ] = ndgrid ( x, y );

    A = sin ( X ) .* sin ( Y );
%
%  A2 is the exact value of the Laplacian.
%
    A2 = - 2.0 * sin ( X ) .* sin ( Y );
%
%  L is our estimate.
%
    L = laplacian5_torus ( A, dx, dy );

    e = rms_norm ( L - A2 );
    fprintf ( 1, '  DX = %g, DY = %g, RMS error = %g\n', dx,dy, e );

  end

  return
end

