Five-point stencil

From Wikipedia, the free encyclopedia

In numerical analysis, given a rectangular grid in one or two dimensions, the five-point stencil of a point in the grid is made up of the point itself together with its four "neighbors".

In one dimension, if the spacing between points in the grid is h, then the five-point stencil of a point x in the grid is

{x − 2h,xh,x,x + h,x + 2h}.

In two dimensions, if for example the size of the rectangles in the grid is h by k, the five point stencil of a point (x,y) in the grid is

{(xh,y),(x,y),(x + h,y),(x,yk),(x,y + k)}.

The five-point stencil is used to write finite difference approximations to derivatives at grid points. For example, the first derivative of a function f of a real variable at a point x can be written using a five-point stencil as

f'(x) \approx \frac{-f(x+2 h)+8 f(x+h)-8 f(x-h)+f(x-2h)}{12 h}

and is of order O\left(h^4\right).

That can be seen from the expansion

\frac{-f(x+2 h)+8 f(x+h)-8 f(x-h)+f(x-2h)}{12 h}=f'(x)-\frac{1}{30} f^{(5)}(x) h^4+O\left(h^5\right)

which can be obtained via Taylor series and Richardson extrapolation.

Image:Mathapplied-stub_ico.png This applied mathematics-related article is a stub. You can help Wikipedia by expanding it.