The 1955 computer experiment where a chain of masses refused to thermalize.
Thirty-two masses between two walls are joined by springs whose force is d plus alpha d squared, and all the energy starts in the lowest normal mode. Fermi, Pasta, Ulam and Tsingou expected the nonlinearity to share it out evenly among all 32 modes; instead it flows into modes 2 to 5 and, about 157 periods later, returns almost entirely to mode 1. The chain is integrated with Yoshida's fourth order symplectic method, hundreds of steps a frame, so the energy error (shown live) stays near 1e-7 on the classic run and around 1e-5 even on the hot ones, and the recurrence is the physics, not the integrator. Mode energies come from a discrete sine transform each frame, shown as a live log-scale spectrum and a history plot that marks each return, while the chain is drawn stroboscopically with its recent envelope and its springs tinted by stretch.
Try it. Drag across the chain to sketch any starting shape, click it to pluck, or click a bar to start in that pure mode. Up and down (or the - and + buttons) change the nonlinearity, left and right change the speed, B switches between the alpha and beta models, 1 to 4 (or Next preset) load presets including a strongly nonlinear and a hot chain that thermalize, R restarts and space pauses.
Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.
Recreate the 1955 Fermi-Pasta-Ulam-Tsingou experiment with JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.
Start simple:
- Make a canvas that fills the window, stays sharp on high-DPI screens (scale by devicePixelRatio), and resizes with the window. Use a dark background.
- Simulate 32 masses on a line between two fixed walls. The force from a spring stretched by d is d + alpha * d * d with alpha = 0.25.
- Start them in the lowest normal mode: displacement x_n = sin(n * pi / 33), at rest.
- Integrate with velocity Verlet (leapfrog) at a time step of about 0.1, running a few hundred steps per frame so the slow energy exchange is visible within seconds.
- Draw the chain as dots joined by lines, with the displacement exaggerated vertically.
Once that works, make it tell the story:
- Each frame, compute the normal mode amplitudes with a discrete sine transform, Q_k = sqrt(2/33) * sum of x_n sin(n k pi / 33), and the mode energies E_k = (P_k^2 + omega_k^2 Q_k^2) / 2 with omega_k = 2 sin(k pi / 66).
- Show a bar chart of the 32 mode energies on a log scale, and a plot over time of the share held by modes 1 to 5. Mode 1 should drain into the others and then come back almost completely after about 157 of its periods.
- Print the total energy error so you can see the integrator is trustworthy, and color the springs by stretch.
Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as a fourth order symplectic integrator, keys to raise alpha until the recurrence breaks into thermalization, or the cubic beta model where only odd modes ever wake up.