function l = laplacian3_interval ( u, dx )

%*****************************************************************************80
%
%% laplacian3_interval() approximates the laplacian on a 1D interval.
%
%  Discussion:
%
%    The domain is represented by nx equally spaced points.
%
%    The laplacian is computed for the interior points, but a value
%    of 0 is returned for the first and last points.
%
%    It is up to the user to decide whether to reset l(1) and l(nx)
%    to nonzero values.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    28 June 2020
%
%  Input:
%
%    real u(nx): the values of a function on an equally spaced grid of points.
%
%    real dx: the spacing between any two consecutive nodes.
%
%  Output:
%
%    real l(nx): the estimate for the laplacian.
%
  nx = length ( u );
  l = zeros ( size ( u ) );
  l(2:nx-1) = ( u(3:nx) - 2.0 * u(2:nx-1) + u(1:nx-2) ) / dx^2;

  return
end

