Crank–Nicolson Heat Equation Solver
Advance the one-dimensional heat equation with Crank–Nicolson, which averages the centered spatial diffusion operator between the old and new time levels. Each step solves a tridiagonal linear system.
How this tool works
For r=αΔt/Δx², Crank–Nicolson gives (I−rA/2)uⁿ⁺¹=(I+rA/2)uⁿ for the finite-difference Laplacian A. The method is second order in time and unconditionally stable for linear diffusion.
Example
Use the same heat-equation grid and diffusivity as the explicit FTCS solver but increase Δt. The solution should remain stable, though an excessively large time step can still reduce accuracy.
Common questions
Does unconditionally stable mean any time step is accurate?
No. Stability and accuracy are different. Large time steps can smear timing or produce nonphysical oscillatory behavior for some initial data even when the linear method does not blow up.
Why is a tridiagonal solver enough?
Second-order centered differences couple each interior node only to its immediate neighbors, creating a tridiagonal matrix in one dimension.