Finite difference coefficients in more than 1 dimension.

162 Views Asked by At

Computing the finite difference coefficients of an arbitrary 1D stencil with varying set of samples and derivative order is well known:

Yet, these do not include multidimensional stencils such as the 5-point stencil in 2D and 7-point stencil in 3D.

As an example, the 5-point von Neumann stencil in 2D can be defined as the following pairs of samples: [[0, 0], [-1, 0], [1, 0], [0, -1], [0, 1]] and has the following corresponding coefficients: [4, -1, -1, -1, -1].

Abuse-of-notation boolean matrix of the stencil: $$\begin{pmatrix} 0 & 1 & 0 \\ 1 & 1 & 1 \\ 0 & 1 & 0 \end{pmatrix}$$ The corresponding coefficients: $$\begin{pmatrix} 0 & -1 & 0 \\ -1 & 4 & -1 \\ 0 & -1 & 0 \end{pmatrix}$$

Is there a formula generalizing the finite difference coefficients to arbitrary dimensions?