Database › Mathematics › Applied mathematics › Numerical analysis
Derivatives are approximated by differences of values on a grid — forward differences with error O(h), central differences O(h²) — turning differential equations into algebraic equations; explicit schemes for diffusion need DΔt/Δx² ≤ 1/2.
Explanation
Taylor expansion shows that the symmetric (central) combinations cancel the even-order error terms. Too small an $h$ amplifies round-off ($\sim\epsilon/h$), so there is an optimal step.
Replacing derivatives in a PDE gives a large sparse linear system (Laplace: each interior value equals the average of its four neighbours, solved by relaxation) or a time-stepping scheme. For $u_t=Du_{xx}$ the explicit scheme is stable only if $r=D\Delta t/\Delta x^2\le\frac12$ (von Neumann analysis); for waves the Courant condition $c\Delta t\le\Delta x$ applies; implicit schemes such as Crank–Nicolson remove the restriction.
Example 1
Estimate the derivative of $\sin x$ at $x=1$ by the central difference with $h=0.1$, and compare the error with $-\frac{h^2}6\cos1$.
Solution
$\frac{\sin1.1-\sin0.9}{0.2}=\frac{0.891207-0.783327}{0.2}=0.539402$; $\cos1=0.540302$, error $-9.0\times10^{-4}$, matching $-\frac{0.01}6\times0.5403$.
Example 2
Show by von Neumann analysis that the explicit scheme $u_j^{n+1}=u_j^n+r(u_{j+1}^n-2u_j^n+u_{j-1}^n)$ is stable only for $r\le\frac12$.
Solution
Insert $u_j^n=g^ne^{ikj\Delta x}$: $g=1-4r\sin^2\frac{k\Delta x}2$. $|g|\le1$ for all $k$ requires $4r\le2$.