Phase Sync Playground

Watch spectral recovery of power-grid voltage angles hit its theoretical threshold — a live, real eigendecomposition, not an animation.
Grounded in arXiv:2607.06762 — Guzel, McRae & Zhang, "Spectral Initialization and Certification for Power System Angle Estimation"

Grid graph  n = 64 buses

ground truth angle θgnd recovered θsi (top eigenvector) edge = noisy angle-difference measurement
drag sliders → · arrow keys adjust noise/density

Controls & live certificate

NOT CERTIFIED
zero-duality-gap check, computed live from S(x)
Observability margin ρ = σn−1(C₀)–
Normalized noise level η = ε / ρ–
Theorem 5 threshold η* = 4√2⁄(3π)0.6002
Duality gap δ(x) = −n·λmin(S(x))–
RMSE(θsi, θgnd)–  (bound: η ≤ – rad)
Eigensolve cost (real 128×128 Jacobi ×2)–

δ(x) vs η — the certificate snapping toward zero live trail of real computed points, log scale

What's actually being computed here

The paper reduces power-system voltage-angle estimation to phase synchronization: recover unit-modulus phases x ∈ ℂⁿ from noisy pairwise angle-difference measurements on the grid graph. The estimator solves min ‖Cx‖² s.t. |x₁| = ⋯ = |xₙ| = 1, equivalent to maximizing x*Hx with H = −C*C — a Hermitian "connection matrix" built straight from the graph and the noisy measurements. This demo builds the classical connection-Laplacian specialization of that same matrix (paper §III–IV, Lemma 1–4): for every edge (i,j) present in the grid, it draws a noisy phase measurement z_ij = exp(i·(θᵢ − θⱼ) + noise) and accumulates it into an n×n complex Hermitian matrix. Every slider drag rebuilds this matrix and diagonalizes it for real — via a from-scratch complex Hermitian eigensolver (a real-symmetric Jacobi rotation on the 2n×2n real embedding of the matrix, since a Hermitian eigenproblem of size n is exactly a real-symmetric eigenproblem of size 2n). The top eigenvector of H, projected onto the unit circle per-entry, is the spectral estimate θsi (paper eq. 19–20) — drawn here as amber arrows next to the true angles.

The duality gap is the paper's actual dual certificate (eq. 31–32): S(x) := C*C − Re[ddiag(C*C · xxᵀ)],   δ(x) := −n·λmin(S(x)) computed here from a second real eigensolve of S(x) each frame. The paper proves 0 ≤ f(x) − f(xwls) ≤ δ(x), so δ(x) ≈ 0 is a genuine certificate of global optimality — not a cosmetic threshold. In the noiseless observable case the paper shows this gap is exactly zero and recovery is exact "without local refinement"; you can watch that happen live by dragging noise to 0.

Honesty check: the paper's fixed threshold η* = 4√2/(3π) ≈ 0.600 (Theorem 5) is explicitly called "quite conservative" by the authors — real δ(x) often stays near zero well past η*, which is exactly what you'll see in the chart. So this demo shows both: the hard theoretical line (η*, dashed), and the live, honest certificate (δ(x) itself) driving the CERTIFIED / NOT CERTIFIED badge.

The real result, in plain language

  • Reduction: once voltage magnitudes are known accurately, estimating phase angles from noisy power-flow measurements is exactly a phase synchronization problem (paper, following Guzel & Zhang [8]).
  • Governing quantity: everything depends on one normalized noise level η := (Ks‖εs‖∞,obs + Ku‖εu‖∞) / ρ (eq. 25), where ρ is the classical observability margin — the smallest singular value of the measurement Jacobian, eq. 10 — and Ks, Ku are network/measurement constants. This demo's slider-driven η = ε/ρ is a simplified single-noise-source version of exactly that ratio.
  • Below threshold: Theorem 5 proves spectral initialization recovers the true angles to RMSE ≤ η radians, and Theorem 6 shows the WLS estimator is unique up to global phase with RMSE ≤ ½η.
  • Noiseless case (η = 0): spectral initialization exactly recovers the ground truth in one shot, and the spectral certificate is exact with zero duality gap — no local refinement needed.
  • Edge density ↔ observability: more/better-placed measurements raise ρ (the graph's algebraic "rigidity" against noise), directly lowering η and pushing δ(x) toward zero — this is why the density slider in this demo moves the same threshold curve.
  • Paper's own experiments (standard IEEE benchmark grids) show the spectral method staying effective beyond the conservative regime the theorems formally cover — reproduced qualitatively here by the gap between the dashed η* line and where δ(x) actually blows up.