Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

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. 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. 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. 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. 4 Explain why a stable but inconsistent finite difference method should not be expected to converge to the correct solution.

Understanding Finite Difference Methods for Differential Equations

A difference formula comes from sampling a smooth function near one location. Taylor expansion explains the idea. Values at nearby grid points contain information about slope and curvature.

When terms are combined in a balanced way, some unwanted Taylor terms cancel. This is why a centered estimate of a slope is usually more accurate than a one-sided estimate. Higher accuracy is useful, but it is not free.

A wider stencil needs more neighboring values and becomes harder to use near an edge. It can also react badly to rough data or sharp jumps.

The formal order of a method describes how fast its truncation error shrinks as the grid is refined. It does not guarantee a small error on every practical grid.

Boundary conditions supply information that the interior stencil cannot provide. For a fixed-value boundary, the value at the edge is known and is inserted directly into the equations. For a fixed-slope boundary, a one-sided difference relates the edge value to a nearby interior value.

Some physical boundaries are mixed. Heat loss through a surface can depend on both temperature and its slope. Boundary handling deserves careful attention because a good interior formula can be ruined by a poor edge formula.

Students should count unknowns and equations after applying every boundary condition. For a second-order spatial problem, two independent boundary conditions are normally needed. They may be placed at opposite ends or, in some models, at the same end.

Time-dependent problems add a second grid direction. The spatial spacing controls how well the shape is resolved. The time step controls how far the calculation moves forward each update.

An explicit method computes the next time level directly from known values. It is simple to program, though its time step may need to be very small. Diffusion is especially restrictive because reducing the spatial spacing requires a much smaller time step.

An implicit method includes unknown future values in the update. This requires solving a system of equations at every time step, but it often permits larger steps. For the heat equation in one dimension, the resulting system is commonly tridiagonal, so it can be solved efficiently without using a general matrix inverse.

Stability concerns the behavior of errors already present in a calculation. Such errors come from rounding, incomplete input data, or the approximation itself. A stable scheme keeps them controlled over many steps.

An unstable scheme can amplify tiny errors until the answer becomes meaningless. For transport problems, the direction of travel matters. Information moving to the right should usually use data from the left side of a grid point.

This is the reasoning behind upwind schemes. Centered spatial formulas can look more accurate on smooth solutions, yet they may produce nonphysical oscillations near fronts.

A reliable study habit is to refine the grid, compare solutions, and measure changes between runs. Check the boundary values, the time step restriction, units, and whether the computed solution follows expected physical behavior such as diffusion smoothing a temperature profile.