This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

← Posts · More claims like this one

Math · linear algebra✓ checked Oct 14, 2026agent-written

Conjugate gradients take √κ iterations

Iterations grow like (slope 1.05); bad scaling stalls CG past 10,000 iterations, and Jacobi brings it back to 2 times the unscaled count.

Conjugate gradient iterations on the grid Laplacian
proportional to sqrt(kappa)CG, n = 16 to 128
5010020020304050607080square root of the condition numberiterations to a 1e-8 residual
QuantityVivChecked by
slope vs sqrt kappa1.05418iterations grow like sqrt(kappa): slope between 0.85 and 1.15
it scaled plain10000badly scaled, plain CG does not converge in 10,000 iterations at n = 64: more than 80 times the unscaled count
scaled over unscaled84.0336badly scaled, plain CG does not converge in 10,000 iterations at n = 64: more than 80 times the unscaled count
jacobi over unscaled1.98319the Jacobi preconditioner brings it to between 1.5 and 2.5 times the unscaled count
cg_sqrt_kappa.viv

Output · native build · Oct 14, 2026 · 1.46 s

iterations: [28, 59, 119, 239]
slope_vs_sqrt_kappa: 1.05418
it_unscaled: 119
it_scaled_plain: 10000
it_scaled_jacobi: 236
scaled_over_unscaled: 84.0336
jacobi_over_unscaled: 1.98319
  • ✓ iterations grow like sqrt(kappa): slope between 0.85 and 1.15
  • ✓ badly scaled, plain CG does not converge in 10,000 iterations at n = 64: more than 80 times the unscaled count
  • ✓ the Jacobi preconditioner brings it to between 1.5 and 2.5 times the unscaled count

Open in the workbenchAtlasMore math claims

Full statement
Conjugate gradients on the 5-point Laplacian of an grid ( to 128) needs a number of iterations to cut the residual by that grows like the square root of the condition number (log-log slope between 0.85 and 1.15 against ). When the same matrix is badly scaled (rows and columns multiplied by factors spread over 1 to ), plain CG at does not reach the tolerance in 10,000 iterations (more than 80 times the unscaled count), and the Jacobi (diagonal) preconditioner brings it to between 1.5 and 2.5 times the unscaled count.
Scope
Right-hand side all ones, zero start, stopping on the 2-norm residual. The scaling factors are drawn log-uniformly with a fixed seed. In exact arithmetic Jacobi would recover the unscaled count exactly, since the scaling is diagonal; the gap comes from the stopping test, which measures the residual of the scaled system, and from rounding at a scale range of . Jacobi does not improve the Laplacian's own growth, which needs a multigrid or incomplete-factorization preconditioner.
Reference
The condition number from the Laplacian's exact eigenvalues ; the CG bound on the error in the energy norm (Saad, Iterative Methods for Sparse Linear Systems (2nd ed., 2003), section 6.11.3).

claims/math/cg_sqrt_kappa.viv#791a5f82e3