Finite difference methods approximate differential equations by replacing derivatives with algebraic expressions on a grid. This cheat sheet helps students connect continuous models to computable linear systems and time-stepping algorithms. It is especially useful for boundary value problems, heat equations, wave equations, and advection equations.
The goal is to give a compact reference for choosing stencils, applying boundary conditions, and checking accuracy.
Key Facts
- The forward difference approximation is u'(x_i) ≈ (u_{i+1} - u_i)/h and has first-order error O(h).
- The backward difference approximation is u'(x_i) ≈ (u_i - u_{i-1})/h and has first-order error O(h).
- The centered difference approximation is u'(x_i) ≈ (u_{i+1} - u_{i-1})/(2h) and has second-order error O(h^2).
- The standard second derivative stencil is u''(x_i) ≈ (u_{i+1} - 2u_i + u_{i-1})/h^2 and has second-order error O(h^2).
- For the heat equation u_t = alpha u_xx, the explicit FTCS method is u_i^{n+1} = u_i^n + r(u_{i+1}^n - 2u_i^n + u_{i-1}^n), where r = alpha dt/h^2.
- The explicit heat equation FTCS method is stable in one space dimension when r = alpha dt/h^2 <= 1/2.
- For linear advection u_t + c u_x = 0 with c > 0, the upwind method is u_i^{n+1} = u_i^n - nu(u_i^n - u_{i-1}^n), where nu = c dt/h.
- A finite difference method is convergent when the numerical solution approaches the exact solution as h and dt approach 0, usually requiring both consistency and stability.
Vocabulary
- Grid
- A grid is a discrete set of points where the unknown solution is approximated instead of being computed at every point.
- Stencil
- A stencil is the pattern of neighboring grid values used to approximate a derivative at a point.
- Truncation error
- Truncation error is the local error made when a derivative is replaced by a finite difference approximation.
- Stability
- Stability means that errors from rounding, initial data, or previous time steps do not grow uncontrollably as the computation advances.
- Consistency
- Consistency means that the finite difference equation approaches the original differential equation as the grid spacing approaches zero.
- CFL condition
- A CFL condition is a time step restriction that relates dt and h so information does not move farther than the numerical method can track.
Common Mistakes to Avoid
- Using a forward difference when the flow direction requires an upwind backward difference is wrong because it can produce unstable oscillations for advection problems.
- Forgetting to divide by h or h^2 in derivative stencils is wrong because the approximation must scale correctly with grid spacing.
- Applying interior stencils directly at boundary points is wrong because boundary points often lack the required neighboring values and need boundary conditions or one-sided stencils.
- Choosing dt without checking stability is wrong because an explicit method can diverge even when the finite difference formula looks accurate.
- Confusing local truncation error with global error is wrong because local error measures one-step formula accuracy while global error includes accumulated error over the whole domain or time interval.
Practice Questions
- 1 Approximate u'(2) using the centered difference formula with h = 0.1, u(1.9) = 3.61, and u(2.1) = 4.41.
- 2 For the heat equation u_t = 0.5 u_xx with h = 0.1, find the largest stable dt for the explicit FTCS method in one space dimension.
- 3 Use the second derivative stencil to approximate u''(1) if h = 0.25, u(0.75) = 0.5625, u(1) = 1, and u(1.25) = 1.5625.
- 4 Explain why a stable but inconsistent finite difference method should not be expected to converge to the correct solution.