Let us consider how to approximate the Laplace operator in one dimension.
The method considered here is based on finite differences and will allow us
to approximate the Laplace operator on a regular grid in a simple and efficient way.
Recall that the Laplace operator in one dimension is just the second derivative.
Let f:R→R be a sufficiently smooth function around a point x.
We then have the Taylor expansion
f(x+h)=f(x)+hf′(x)+2h2f′′(x)+6h3f′′′(x)+O(h4)
for some h>0 and
f(x−h)=f(x)−hf′(x)+2h2f′′(x)−6h3f′′′(x)+O(h4).
Adding these two equations and rearranging a bit gives
f(x+h)+f(x−h)−2f(x)=h2f′′(x)+O(h4)
and thus
Δf(x)=f′′(x)=h2f(x−h)−2f(x)+f(x+h)+O(h2).
Let us now approxiate the Laplace operator on a regular grid.
Let f:[0,1]→R be a sufficiently smooth function with f(0)=f(1)=0.
We divide the interval [0,1] into n+1 subintervals of equal length h=1/(n+1)
and set xi=ih for i=0,1,…,n+1.
We now have
yi=h2f(xi−1)−2f(xi)+f(xi+1),i=1,2,…,n,
as an approximation for Δf(xi) (recall that f(x0)=f(xn+1)=0).