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,x − h,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
- {(x − h,y),(x,y),(x + h,y),(x,y − k),(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
and is of order
That can be seen from the expansion
which can be obtained via Taylor series and Richardson extrapolation.