The Crank-Nicolson Method
Crank-Nicolson averages explicit and implicit steps to solve parabolic PDEs with second-order accuracy in time and unconditional stability.
Averaging in time
The Crank-Nicolson method is the trapezoidal rule applied to time-dependent PDEs discretized in space. It evaluates the spatial operator as the average of its explicit (current-time) and implicit (next-time) values. This centering in time gives second-order temporal accuracy, a clear improvement over the first-order Euler schemes.
Stability
Because it is the trapezoidal rule, Crank-Nicolson is A-stable: for the heat equation it remains stable for any time step, unlike explicit FTCS which requires the step to satisfy r <= 1/2. This lets the time step be chosen for accuracy rather than stability, a major practical advantage for diffusion problems.
import numpy as np
# Crank-Nicolson for u_t = u_xx forms (I - r/2 L) u^{n+1} = (I + r/2 L) u^n
def cn_matrices(n, r):
main = np.ones(n)
L = (np.diag(-2*main) + np.diag(np.ones(n-1),1)
+ np.diag(np.ones(n-1),-1))
I = np.eye(n)
return I - 0.5*r*L, I + 0.5*r*L # left, right
The oscillation caveat
Crank-Nicolson is A-stable but not L-stable: its amplification factor approaches -1, not 0, for the stiffest modes. Large time steps applied to sharp initial data can therefore produce slowly decaying oscillations (ringing). Damping the first few steps with backward Euler, the Rannacher startup, suppresses this artifact.
Extensions
Each step requires solving a linear system, tridiagonal in one dimension and sparse in more, handled by the Thomas algorithm or sparse solvers. In multiple dimensions, alternating-direction implicit (ADI) schemes split the step into cheap one-dimensional solves while keeping second-order accuracy and good stability.
Crank-Nicolson and ADI schemes are standard for the diffusion-dominated transport equations arising in breeder Hyperion models, where large stable time steps reduce total cost.