    function lap = fourlap2(f,n,m)

% lap = fourlap2(f,m) computes the Laplace of the function
% f(x,y) using the Fourier differentiation process.   The function 
% is assumed to be 2pi-periodic and the input data values f should 
% correspond to samples of the function at N equispaced points on [0, 2pi)^2.
% The Fast Fourier Transform is used.
% 
%  Input:
%  f[n,m]:  matrix of samples of f(x,y) at (x_i,y_j) = (2*i*pi/n,2*j/pi/m)
%
%  Output:
%  Lap:     f_xx+f_yy


waven=[0:n/2 -n/2+1:-1]';
wavem=[0:m/2 -m/2+1:-1];
for j=1:m; for i=1:n;
wave(i,j)=-waven(i)^2-wavem(j)^2;
end; end;
lap=wave.*f;
