function skeleton1 ( )

%*****************************************************************************80
%
%% skeleton1 estimates the Laplacian on a 1D periodic domain.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    27 June 2020
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'skeleton1\n' );
  fprintf ( 1, '  Estimate the Laplacian on a 1D periodic region.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  nx  || error ||\n' );
  fprintf ( 1, '\n' );

  for nx = [ 7, 13, 25, 49 ]

    xmin = 0.0;
    xmax = 1.0;
    x = linspace ( xmin, xmax, nx );
    dx = ( xmax - xmin ) / ( nx - 1 );
%
%  Create periodic grid XP, by reducing nx and removing last point.
%
    nxp = nx - 1;
    xp = x(1:nxp);
%
%  Evaluate function and exact Laplacian.
%
    up = sin ( 2.0 * pi * xp );
    uxxp = - 4.0 * pi^2 * sin ( 2.0 * pi * xp );
%
%  Compute discrete Laplacian and compare.
%
    lp = laplacian_circle ( up, dx );
    diff = rms_norm ( uxxp - lp );
    fprintf ( 1, '  %2d  %g\n', nx, diff );

  end

  return
end
function lp = laplacian_circle ( up, dx )

%*****************************************************************************80
%
%% laplacian_circle approximates the laplacian on a periodic 1D domain.
%
%  Discussion:
%
%    If the domain is represented by nx equally spaced points, it is
%    assumed that only the data for the first nxp=nx-1 points is supplied.
%    In other words, the last entry of up() is at the node just BEFORE
%    the node where the periodic condition takes effect.
%
%    This is the standard laplacian estimate on a uniform grid, 
%    except that, by periodicity, and suppressing the last node, we have
%    the east neighbor of node 1 is the last node, and
%    the west neighbor of the last node is node 1.
%
%    This function offers four equivalent ways of computing the Laplacian.
%
%  Modified:
%
%    27 June 2020
%
%  Input:
%
%    real up(nxp): the values of a function on an equally spaced grid
%    of points in a periodic domain.
%
%    real dx: the spacing between any two consecutive nodes.
%
%  Output:
%
%    real lp(nxp): the estimate for the laplacian.
%
  nxp = length ( up );
  lp = zeros ( size ( up ) );

  for ip = 1 : nxp
    lp(ip) = ?
  end

  return
end

