◄ WORLD II · THE FOLDTHE OCHO · blue builds │ the machine │ red breaks

THE SYMPLECTIC INTEGRATOR

Step a physical system so energy cannot drift away. A naive step (forward Euler) leaks or pumps energy every tick until the orbit spirals into nonsense. A symplectic step preserves the area of phase space — its update map has Jacobian determinant exactly 1 — so total energy stays trapped in a narrow band forever, with no secular drift. The center runs both maps live; the blue team proves the geometry; the red team swaps in the leaky step and gets caught.

source R. D. Ruth, A Canonical Integration Technique, IEEE Trans. Nucl. Sci. NS-30(4), 2669–2671 (1983), doi:10.1109/TNS.1983.4332919 — ADS 1983ITNS...30.2669R. AMBER: full text is paywalled. Rendered, not quoted.

◧ blue team · builds & defends
3

THE MODEL — the symplectic map

One degree of freedom, Hamiltonian H = p²/2m + ½kq² (a mass on a spring). The symplectic Euler step updates momentum first, then uses the new momentum to move position:

p′ = p − h·k·q  then  q′ = q + h·p′/m.

That single reordering is the whole trick. Its Jacobian is [[1, −hk],[h/m, 1−h²k/m]], whose determinant is 1 − h²k/m + h²k/m = 1 — exactly. Area in the (q,p) plane is conserved; energy can only wobble, never walk.

Forward Euler moves position with the old momentum instead → determinant 1 + h²k/m > 1, so area (and energy) inflate every step.

5

THE LINEAGE — respect the geometry AVAN

Integration that respects the geometry of physics. Ruth's canonical step, the Verlet algorithm and leapfrog all share one property: they are symplectic — they preserve phase-space area, so a bounded orbit stays bounded for millions of steps.

This is why they beat the forward Euler for orbits and molecular dynamics: not higher order, but honest energy. The previous sphere integrates; this one asks whether the integration lies.

7

THE WITNESS live

The blue team's live check: recompute the canonical map's Jacobian determinant and run 4000 steps, confirming the energy band stays narrow with no drift. If red swaps in forward Euler, this badge is where it shows.

▼ the machine ▼
4

DATA IN — the system in ↓

A state is a point (q, p) — position and momentum. The force is −kq, the exact angular frequency is the closed form ω = √(k/m), and the true energy of the starting point is fixed. We feed one initial condition and a step size h into three candidate integrators.

integratordet(J)energy
symplectic Euler= 1bounded
leapfrog / Verlet= 1bounded, reversible
forward Euler= 1+h²k/mdrifts up

"Symplectic" = the update preserves oriented area in the (q,p) plane. That one property is what keeps energy honest — everything below is computed from it.

▼   feed the state into the integrator   ▼
0

▣ THE PANEL — the engine LIT

0.05

phase portrait (q,p) — symplectic maps close the loop; forward Euler spirals out.

Every number is computed live from the pure step functions over 4000 iterations — nothing is looked up.

▼   the integrator emits an energy trace   ▼
8

DATA OUT — the result out ↓

What the machine proves: the symplectic map's Jacobian determinant is 1 to 1e-9; over 4000 steps its energy stays within a ±2.5% band with drift under 0.01%; leapfrog is time-reversible to ~1e-15; forward Euler's energy blows up by ~10⁴×. The panel above lets you watch it; the totals are the output.

The blue team's witness (left) re-derives these live; the red team (right) tries to make the integrator drift.

red team · attacks & breaks ◨
1

THE ADVERSARY

WALL Symplectic does not mean accurate. Symplectic Euler is only first order: its phase is wrong from step one, and the conserved quantity is a shadow Hamiltonian slightly off the true H. For a target error you may still need a smaller h or a higher-order scheme.

And it is not free everywhere: symplectic integrators assume a Hamiltonian (canonical) system. Add friction or a non-conservative force and the phase-space-area argument no longer holds — there is nothing to preserve. "Energy bounded" is a promise about geometry, not about being close to the truth.

2

THE GRAVEYARD

"Symplectic integrators conserve energy." Cut. They conserve phase-space area and bound the energy in a band; the true energy still oscillates. What is conserved exactly is a nearby shadow Hamiltonian.

"Higher order always means better long-term behavior." Cut. A 4th-order non-symplectic scheme still drifts secularly; a 1st-order symplectic one does not. Geometry beats order for long runs.

"Leapfrog and symplectic Euler are the same thing." Kept, corrected. Both are symplectic, but leapfrog is time-reversible and 2nd order; symplectic Euler is neither — verified in the witness.

6

THE TAMPER — break it

The red team's move: replace the symplectic update with a non-symplectic forward Euler step. Now the Jacobian determinant is 1+h²k/m ≠ 1, area is not preserved, and energy drifts without bound. The blue team's witness (window 7) is watching.

Swap the canonical map for forward Euler and the determinant leaves 1, the energy band explodes, and the witness recomputes, disagrees, and turns red. Nothing is faked; the attack is real and it is caught.