What you are looking at
Each site of a grid holds an angle, like a compass needle free to point anywhere in the plane. Neighbouring needles prefer to agree: the energy of a pair is minus the cosine of the angle between them. Temperature lets them disagree. At every step the simulation proposes a small random turn for each needle and accepts it with the Metropolis rule, half the grid at a time, on your graphics card.
Walk around any small square of four needles and add up how far the direction turns. The total is always a whole number of full turns. Where it is one, a gold ring marks a vortex; minus one, an ice-blue ring an antivortex. Because the total over the whole periodic grid is zero, they are born and die in pairs. Quench a hot field and watch pairs find each other and vanish; heat it past the tick and they multiply.
H = − Σ⟨ij⟩ cos(θᵢ − θⱼ) nearest neighbours, periodic lattice P = min(1, exp(−ΔE / T)) Metropolis acceptance, δ ~ U(−1.35, 1.35) qₚ = (1/2π) Σ∂p wrap(θⱼ − θᵢ) ∈ ℤ winding around each plaquette
The mathematics behind it
This is a finite companion to Essential Singularity of the Correlation Length in the Planar XY Model (5 October 2026), released in OpenAI’s mathematics repository and produced by an internal OpenAI model. It proves, for this exact cosine model on the square lattice, the behaviour Berezinskii, Kosterlitz and Thouless predicted in the 1970s: approaching the transition from the hot side, the correlation length grows like the exponential of one over the square root of the distance to the critical point, faster than any power law.
The tick at T ≈ 0.89 is the transition temperature estimated numerically for this model, 1/β꜀ with β꜀ ≈ 1.1199 (M. Hasenbusch, Journal of Physics A 38, 5869, 2005).
What it does not show
The traces are a disclosed visual interpolation: a Gaussian-smoothed (σ = 1.15 lattice spacings) copy of the spins, drawn by line-integral convolution while the simulation runs and as computed streamlines when it pauses. They are not trajectories of anything. Vortex markers use the unsmoothed field. A finite lattice after a finite number of sweeps is not in certified equilibrium, and nothing here measures the correlation length or tests the theorem. The model follows the GLOBAÏA Atlas of Mathematical Forms (plate “The topology of a turn”); the default start reproduces its recipe (correlated start, σ = 7, then 192 sweeps at T = 0.55), with a different random-number generator, so the field is statistically equivalent rather than identical.