THE FIRST INTEGRAL a quantity the motion carries unchanged — energy along the orbit
A first integral of a dynamical system is a quantity that stays constant along every trajectory — the motion moves the state around, but this number never changes. Energy is the archetype: a frictionless pendulum trades height for speed and back, but its total energy ½(x²+p²) is fixed, so its orbit in phase space is a circle of constant radius. First integrals are what make a system solvable: each one confines the motion to a lower-dimensional surface (a level set), and enough of them pin the trajectory completely. They are conserved quantities in the most operational sense — the invariant you can watch not change as you integrate the equations forward.
THE TECHNIQUE a quantity constant along the flow; energy x²+p² on a circular orbit
A harmonic oscillator whose orbit is a rotation in phase space. The demo advances the state a quarter turn and checks the energy is unchanged: live demo
HISTORY & CREDIT classical mechanics (Euler, Jacobi)
“As the pendulum swings, everything about its state changes.” — its energy does not. Position and momentum trade endlessly, but the first integral ½(x²+p²) holds, confining the orbit to a circle. cited
lineage · Euler, Lagrange, Jacobi — first integrals (constants of the motion) as the route to solving mechanical systems. relation · Noether (dart 291) explains why they exist; Liouville (dart 292) uses them to foliate phase space. now · integrable systems, conserved quantities, the invariants a numerical method should preserve.
The state races around the orbit; the first integral stands still. Energy is the quantity the motion is not allowed to spend — the invariant you watch hold as you integrate. Euler-Jacobi
RECOMMEND FOR I-13 energy constant along the orbit, computed
On the canonical compiler, the state (3,4) has energy 25; a quarter-turn takes it to (4,−3), still energy 25:
$ i13 run inv_firstintegral.i13 # energy before and after a quarter orbit
E_before = 25
E_after = 25
diff = 0 -- energy is constant along the trajectory
Recommend: the first integral is the batch's theme at its most operational — a quantity you watch not move as the system evolves — and i13 enacts it exactly. A quarter-turn of the harmonic oscillator sends (3,4)→(4,−3), and the energy x²+p²=25 is unchanged, difference 0 (the rotation is rational, so f64 stays exact). It closes the arc opened by Noether (291, why conserved quantities exist) and Liouville (292, how they shape phase space): here is one of those quantities, held constant along a trajectory i13 integrates. The invariant, watched as it refuses to change — the whole batch in one energy check.