MTH 492 · Numerical Methods
Our notes
2 min readThe fully implicit (backward) scheme
Take the space difference at the new time level:
−r uᵢ₋₁ⁿ⁺¹ + (1 + 2r) uᵢⁿ⁺¹ − r uᵢ₊₁ⁿ⁺¹ = uᵢⁿ
- Each step needs a tridiagonal solve (Thomas algorithm), cheap.
- Unconditionally stable: any r works. Error O(k + h²).
Crank-Nicolson
Average the explicit and implicit space differences (centre in time):
−(r/2) uᵢ₋₁ⁿ⁺¹ + (1 + r) uᵢⁿ⁺¹ − (r/2) uᵢ₊₁ⁿ⁺¹ = (r/2) uᵢ₋₁ⁿ + (1 − r) uᵢⁿ + (r/2) uᵢ₊₁ⁿ
- Unconditionally stable and second order in time and space: O(k² + h²).
- The usual choice for diffusion problems.
Worked example
Same problem as the explicit scheme (u_t = u_xx, u(x, 0) = sin πx, ends at zero), h = 0.25, r = 1, so k = 0.0625: one step reaches the time the explicit scheme needed two steps for.
With r = 1 the right side is ½(uᵢ₋₁ + uᵢ₊₁) (the (1 − r)uᵢ term vanishes):
- Node 1: ½(0 + 1) = 0.5
- Node 2: ½(0.70711 + 0.70711) = 0.70711
- Node 3: 0.5
The system (by symmetry u₁ = u₃):
2u₁ − ½u₂ = 0.5 and −u₁ + 2u₂ = 0.70711 (the second from −½u₁ + 2u₂ − ½u₃).
From the first: u₂ = 4u₁ − 1. Then −u₁ + 8u₁ − 2 = 0.70711, so u₁ = 0.38673, u₂ = 0.54692.
| Crank-Nicolson | Explicit (two steps) | Exact | |
|---|---|---|---|
| x = 0.5, t = 0.0625 | 0.5469 | 0.5000 | 0.5396 |
Crank-Nicolson is more accurate with half the steps.
A caution
With large r, Crank-Nicolson stays stable but can show slowly decaying oscillations near sharp initial data (like a sudden temperature jump). Fixes: a few implicit steps at the start, or a smaller r.
Comparing the three
| Scheme | Stability | Accuracy | Work per step |
|---|---|---|---|
| Explicit | r ≤ ½ | O(k + h²) | very little |
| Implicit | always | O(k + h²) | one tridiagonal solve |
| Crank-Nicolson | always | O(k² + h²) | one tridiagonal solve |
In two space dimensions
The implicit system is no longer tridiagonal. The ADI (alternating direction implicit) method splits each step into two half-steps, implicit in x then in y, each a set of tridiagonal solves.
Exams usually ask
- Set up the Crank-Nicolson equations for one step and solve them.
- Compare explicit, implicit and Crank-Nicolson schemes.
Common mistake
Leaving out the boundary values when writing the first and last equations. They appear on both sides (old and new levels) unless they are zero.
Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.
Read
-
Crank–Nicolson method
(opens en.wikipedia.org in a new tab)
Wikipedia, Crank–Nicolson method, CC BY-SA 4.0 · licence
Watch
-
Best pick Crank-Nicolson Method for the Diffusion Equation | Lecture 72 | Numerical Methods for Engineers
14 min · ≈ 63 MB · about ₦35
(opens youtube.com in a new tab)
-
Crank Nicolson Method - Problem 1 - Partial Differential Equation - Engineering Mathematics 3
15 min · ≈ 68 MB · about ₦38
(opens youtube.com in a new tab)
-
Heat Equation Solved Using Crank-Nicolson and Gauss-Seidel Methods | Step-by-Step Tutorial
16 min · ≈ 72 MB · about ₦40
(opens youtube.com in a new tab)
-
Solving Heat equation PDE using Crank Nicholson method
18 min · ≈ 81 MB · about ₦45
(opens youtube.com in a new tab)
-
Application of Crank Nicolson Method for Finite Differencing
32 min · ≈ 144 MB · about ₦81
(opens youtube.com in a new tab)
We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.