Back

Linear-system solvers: direct vs iterative

What you are seeing: the discrete 1D Poisson problem u=sin(πx)-u'' = \sin(\pi x) on NN grid points. The same right-hand side is fed to a Thomas direct solver (exact, O(N)O(N)), Jacobi, Gauss-Seidel, and conjugate gradient. The lower panel tracks the residual norm vs iteration count; CG converges in at most NN steps in exact arithmetic.

Figure 1. Solution and residual history for four solvers on u=f-u'' = f.
N (grid)32
solver

WHAT TO TRY

  • Vary each control and watch the rail readouts respond.
  • Compare the diagnostic plot against the live scene.