The Crank-Nicolson method is an implicit finite difference method for approximating solutions of partial differential equations, especially diffusion equations. It averages the spatial difference operator between the old and new time levels, corresponding to the trapezoidal rule in time.
For the one-dimensional heat conduction equation with
, let
approximate
and set
. The scheme is
With prescribed endpoint values, each time step requires solving a linear system of equations with a tridiagonal matrix. For sufficiently smooth solutions, the method is second order in both time and space.
For this linear diffusion problem with periodic or homogeneous fixed endpoint conditions, the scheme has numerical stability without
a restriction on .
Numerical stability does not imply that all
step sizes give accurate or nonoscillatory solutions. Large time steps can retain
spurious oscillations in rapidly varying components of the data.