Finite difference method studies numerical techniques to approximate derivatives and solve differential equations in various scientific fields.
The finite difference method transforms a differential equation into a system of algebraic equations: derivatives are replaced by differences between the function values at nearby points on a grid. It is the simplest way to solve problems with derivatives on a computer [1].
With step $h$, from the Taylor expansion (see the Taylor row) one obtains:
- Forward difference: $f'(x) \approx \dfrac{f(x + h) - f(x)}{h}$, error of order $h$.
- Centered difference: $f'(x) \approx \dfrac{f(x + h) - f(x - h)}{2h}$, error of order $h^2$.
- Second derivative: $f''(x) \approx \dfrac{f(x + h) - 2f(x) + f(x - h)}{h^2}$, error of order $h^2$.
[1][2]
For $f(x) = \sin x$ in $x = 1$, with $h = 0.1$ the forward difference errs by about $0.043$, the centered difference by about $0.0009$; with $h = 0.01$ the errors are about $0.0042$ and $0.000009$ (calculation). Reducing $h$ by a factor of ten, the first error decreases by $10$ and the second by $100$.
One solves $-u'' = 2$ on $[0, 1]$ with $u(0) = u(1) = 0$ (assumed values). The exact solution is $u(x) = x(1 - x)$. With $h = 0.25$ and internal nodes $x_1, x_2, x_3$ one obtains the system $\dfrac{1}{h^2}\begin{pmatrix}2 & -1 & 0\\ -1 & 2 & -1\\ 0 & -1 & 2\end{pmatrix}\mathbf{u} = \begin{pmatrix}2\\2\\2\end{pmatrix}$, whose solution is $\mathbf{u} = (0.1875;\ 0.25;\ 0.1875)$, equal to the exact values (calculation). The system is tridiagonal and is solved efficiently (see the row on linear systems).
A method converges if for $h \to 0$ the numerical solution tends to the exact one. For linear problems this requires consistency (the truncation error tends to $0$) and stability. In evolution problems, for example $u_t = \alpha u_{xx}$, the time step must satisfy a stability condition.
Heat conduction, waves, fluid dynamics, finance (Black-Scholes equation) and meteorology (general observation). For the reference equations see the rows on ordinary differential equations and partial differential equations.
It works well on regular grids, but is more difficult with domains of complicated shape: in that case the finite element method is preferred (see the dedicated row). Small steps reduce the truncation error but increase rounding error.
[1] Wikipedia (it): Metodo delle differenze finite
[2] Wikipedia (en): Finite difference method
Generating summary…