demoAINumerics
The eigenvalues of a random matrix fill Wigner's semicircle
Fill a symmetric matrix with independent random numbers, divide by , and look at its eigenvalues. They do not scatter. They fill the semicircle , whatever distribution the entries came from.
Open in the workbenchDownload .vivOutputs below are from the site build’s run; Run all runs it again in your browser.
Look inside this program
- Atlas
The program’s map: every function and which calls which.
There’s no recorded run of this program yet.
Only the entries' variance matters; these are uniform on , which has variance 1 and looks nothing like a Gaussian. The even moments of the semicircle are the Catalan numbers because counts closed walks that never cross themselves. The tests check the second, fourth and sixth moments (1, 2 and 5), and that no eigenvalue lies beyond .
At the program runs in your browser in about a tenth of a second. The post also shows a recorded run of the same
program at (the large setting), compiled to C and run natively; the Jacobi
eigensolver costs per sweep, so that run takes minutes. Its histogram is smoother, and
its largest eigenvalue in absolute value is .
Printed
Tests 4 of 4 pass
- the second moment is 1: the first Catalan number (passes)
- the fourth moment is 2: the second (passes)
- the sixth moment is 5: the third (passes)
- nothing escapes the edge at 2 by more than a tenth (passes)
The large run, recorded by the author
N = 2000 · compiled Viv -> C (viv build), one core of an Apple M2 Pro, 269 s, 2026-10-16 · viv run --set N=2000 posts/2026-09-21-wigner-semicircle.viv
- ✓ the second moment is 1: the first Catalan number
- ✓ the fourth moment is 2: the second
- ✓ the sixth moment is 5: the third
- ✓ nothing escapes the edge at 2 by more than a tenth