function y = D2eq3_8(x);
% 
% This function evaluates the second derivative operator
% for the finite differences method, Eq. (3.8),
% p. 42 in 
% D.A. Anderson, J.C. Tannehill, R.H. Pletcher,
% "Computational Fluid Mechanics and Heat Transfer", Hemisphere, New York, 1984.
%
np = length(x); % number of points 
dx = x(2)-x(1);
y = zeros(np, np); % initialization
for i=2:np-1 % first and last rows extra
   y(i,i-1) = 1/dx^2;
   y(i,i) = -2/dx^2;
   y(i,i+1) = 1/dx^2;
end
y(1,1) = 2/dx^2;
y(1,2) = -5/dx^2;
y(1,3) = 4/dx^2;
y(1,4) = -1/dx^2;
y(np,np-3) = -1/dx^2;
y(np,np-2) = 4/dx^2;
y(np,np-1) = -5/dx^2;
y(np,np) = 2/dx^2;


