Where did the Finite Difference Coefficients come from?

1.4k Views Asked by At

Finite Difference Coefficients allows one to estimate various derivatives. My question is, where did they come from? How do you derive the finite difference coefficients?

2

There are 2 best solutions below

0
On

The coefficients can be found by computing the Taylor Series for a function $f$ at several points (creating a stencil), then adding a linear combination of the approximations of the function together to get the desired quantity (typically a derivative) at a given point.

See Wikipedia article for more details

1
On

A more general (and numerically stable) way of deriving them is by means of Lagrange interpolation. Say that we are interested in the function $u(x)$ and that we have $n+1$ data values $x_j$, $j=0,1,\dots,n$. The Lagrange interpolating polynomial for $u(x)$ becomes $$ p_n(x) = \sum_{j=0}^n L_j(x) u(x_j), $$ where $$ L_j(x) = \frac{\prod_{i\neq j} (x-x_i)}{\prod_{i\neq j}(x_j-x_i)}. $$ Then, the $k$th derivative of $u(x)$ at, say $x=0$, is approximated by $$ \frac{\text{d}^ku(x)}{\text{d}x^k}\Big|_{x=0} \approx \frac{\text{d}^k p_n(x)}{\text{d}x^k}\Big|_{x=0} = \sum_{j=0}^n \frac{\text{d}^k L_j(x)}{\text{d}x^k}\Big|_{x=0} u(x_j) = \sum_{j=0}^n c_j^{(k)} u(x_j), $$ where $c_k^{(j)}$ are the finite difference coefficients. Note that this holds for any grid distribution $x_0, x_1, \dots, x_n$ so long as the points are distinct.