Computing Library › Numerical Methods
Numerical Methods

The Finite Difference Method

Finite differences approximate derivatives by ratios of function values on a grid, turning differential equations into algebraic systems.

From derivatives to differences

The finite difference method (FDM) replaces continuous derivatives with linear combinations of nodal values on a structured grid. The classical estimates come from Taylor expansion. The forward difference (f(x+h)-f(x))/h is first-order accurate; the centered difference (f(x+h)-f(x-h))/(2h) is second-order accurate because the leading error terms cancel. The second derivative uses (f(x+h)-2f(x)+f(x-h))/h^2, again second order.

Higher-order stencils widen the footprint: a five-point stencil gives fourth-order accuracy for the first and second derivatives. The tradeoff is a larger bandwidth in the resulting matrix and greater sensitivity near boundaries, where one-sided stencils must replace centered ones.

Truncation error and consistency

A scheme is consistent if its truncation error vanishes as the grid spacing h goes to zero. The order of accuracy is the power of h in the leading error term. Consistency alone is not enough for a correct answer: by the Lax equivalence theorem, for a well-posed linear problem a consistent scheme converges if and only if it is stable.

Structured-grid strengths and limits

FDM is simple to implement, cheap per node, and delivers high order on smooth solutions. Its main limitation is geometry: logically rectangular grids struggle with curved or complex boundaries. Body-fitted coordinate transformations and immersed-boundary corrections extend FDM to shaped domains, but at the cost of extra metric terms.

In fusion modeling, finite differences underpin many equilibrium and transport codes on flux-aligned coordinates, where the geometry is smooth enough that high-order stencils are efficient. The method is often the baseline against which finite-volume and finite-element discretizations are compared.