function laplacian3_interval_uneven_test ( )

%*****************************************************************************80
%
%% laplacian3_interval_uneven_test() tests laplacian3_interval_uneven().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    23 September 2024
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'laplacian3_interval_uneven_test():\n' );
  fprintf ( 1, '  laplacian3_interval_uneven() approximates the Laplacian\n' );
  fprintf ( 1, '  operator applied to a function on an unevenly spaced grid.\n' );

  for test = 1 : 2

    if ( test == 1 )
      fprintf ( 1, '\n' );
      fprintf ( 1, '  Use EVEN spacing:\n' );
      fprintf ( 1, '\n' );
    else
      fprintf ( 1, '\n' );
      fprintf ( 1, '  Use UNEVEN spacing:\n' );
      fprintf ( 1, '\n' );
    end

    for p = [ 1, 2, 4, 8 ]

      nx = 5 * p;
      xmin = 0.0;
      xmax = 2.0 * pi;
      if ( test == 1 )
        x = linspace ( xmin, xmax, nx );
      else
        x = r8vec_cheby1space ( nx, xmin, xmax );
      end

      dxmax = max ( x(2:nx) - x(1:nx-1) );

      A = sin ( x );
%
%  A2 is the exact value of the Laplacian.
%
      A2 = - sin ( x );
%
%  L is our estimate.
%
      L = laplacian3_interval_uneven ( A, x );
%
%  Ignore error at first and last nodes.
%
      e = rms_norm ( L(2:nx-1) - A2(2:nx-1) );
      fprintf ( 1, '  DXMAX = %g, RMS error = %g\n', dxmax, e );

    end

  end

  return
end

