Loading the engineShared by all simulations, so the next one opens instantly.
The physics

In 1964 the astronomers Michel Hénon and Carl Heiles asked whether a star moving in the smooth gravitational field of a galaxy has a third conserved quantity besides its energy and angular momentum. Observed stellar velocities hinted that it does, but nobody could write one down. They reduced the question to a particle in a plane with a simple cubic potential and followed its orbits numerically. At low energy the orbits behaved as if a third integral existed. At higher energy large parts of phase space turned chaotic, and the third integral was gone. It was one of the first clear pictures of chaos in a Hamiltonian system.

What you see

The canvas shows the particle’s path in the (x,y) plane. The white dot is the current position, and the trail is colored by the momentum px, from blue for motion to the left to orange for motion to the right. The canvas fades slowly, so older parts of the path dim out. The total energy and the position are printed in the corner. For E<1/6 the particle cannot leave the triangle whose corners are the three saddle points of the potential, (0,1) and (±3/2,−1/2), drawn faintly on the canvas.

Every preset starts at y=0 with px=0 and the particle moving straight up, with py chosen so that the energy is exactly E.

Regular KAM orbit (E=0.08): the particle starts at x=0.2. At this low energy almost all orbits are regular, and this one moves on a torus: its path fills a rounded region around the origin, out to about x=±0.39, in a pattern that never turns irregular.

Mixed chaos/order (E=0.12): the particle starts at x=0.1, as it does by default. At this energy regular and chaotic orbits coexist. This one is regular: it fills a narrow band around the vertical axis and never wanders off it.

Mostly chaotic (E=0.16): close to the escape energy, where most orbits are chaotic. The particle starts at x=0.3 and wanders irregularly over most of the triangle, with a largest Lyapunov exponent of about 0.12.

At separatrix (E≈1/6): E=0.165 and x=0.3. The orbit is chaotic: it never repeats and over time covers most of the triangle. The energy is just below 1/6, so it cannot escape.

Governing equation

H=12(px2+py2)+12(x2+y2)+x2y−13y3

Hamilton’s equations give

x˙=px,y˙=py,p˙x=−x−2xy,p˙y=−y−x2+y2.

The potential has threefold symmetry. Its minimum is at the origin and its three saddles sit at energy 1/6; above that, orbits can leave through the gaps between them. Hénon and Heiles found almost only regular orbits at E=1/12, a large chaotic region at E=1/8, and almost nothing but chaos near E=1/6. The simulation integrates the four equations with fourth-order Runge-Kutta by default, in four substeps per step.

Parameters

Energy E: the total energy, 0.01 to 0.17 (default 0.12). Values above 1/6≈0.167 let the particle escape.

Initial x₀: the starting position on the x axis, −0.5 to 0.5 (default 0.1). Starting exactly at 0 puts the particle on the invariant vertical axis: the force there has no sideways component, so it only oscillates up and down.

Time step dt: 0.01 to 0.1 (default 0.05), split into four substeps.

Integrator: Runge-Kutta 4 by default. Leapfrog and Yoshida 4 are symplectic and keep the energy error bounded over long runs.