Jupiter! and the KAM theorem

(Sethna, “Entropy, Order Parameters, and Complexity”, ex. 4.4)
© 2016, James P. Sethna, all rights reserved.

This exercise mostly uses classical mechanics to illustrate the KAM theorem. As such, we won’t do much programming -- we’ll implement Netwton’s law of gravitation, set up the planets, and work out the details of the Poincaré section for you. It’s your job to understand and explain the implications for statistical mechanics.
The foundation of statistical mechanics is the ergodic hypothesis: any large system will explore the entire energy surface. We focus on large systems because it is well known that many systems with a few interacting particles are definitely not ergodic.
The classic example of a non-ergodic system is the Solar System. Jupiter has plenty of energy to send the other planets out of the Solar System. Most of the phase-space volume of the energy surface has eight planets evaporated and Jupiter orbiting the Sun alone; the ergodic hypothesis would doom us to one long harsh winter. So, the big question is: why has the Earth not been kicked out into interstellar space?
Mathematical physicists have studied this problem for hundreds of years. For simplicity, they focused on the three-body problem: for example, the Sun, Jupiter, and the Earth. The early (failed) attempts tried to do perturbation theory in the strength of the interaction between planets. Jupiter’s gravitational force on the Earth is not tiny, though; if it acted as a constant brake or accelerator, our orbit would be seriously perturbed in a few thousand years. Jupiter’s effects must cancel out over time rather perfectly ...
This exercise is mostly discussion and exploration.


Set constants. We’ll vary Jupiter’s mass several times, so we write a routine to reset it.
Masses in earth masses; radii in AU; time in years
G = 4 π^2 / SunMass
Jovian year frequency = ω = sqrt(G (JupiterMass+SunMass) / RJ^3)

Jupiter and the Sun go around in circular orbits about their center of mass, with radii RJcm and RScm. The other constants are just to simplify the typing.

EarthMass=1.;
TrueJupiterMass=317.83;
SunMass=332830.;
RJ=5.20316;
G=4π^2/SunMass;

SetJupiterMass[NewJupiterMass_] := (JupiterMass = NewJupiterMass;  ω = Sqrt[G(JupiterMass+SunMass)/RJ^3]; RJcm=RJ (SunMass/(JupiterMass+SunMass));RScm=RJ (JupiterMass/(JupiterMass+SunMass));GMeMj=G EarthMass JupiterMass;GMeMs=G EarthMass SunMass;)
SetJupiterMass[TrueJupiterMass]

Standard initial conditions: start Earth along x, with velocity along y. (Jupiter starts along x as well.)

RxEarth0=1.;
RyEarth0=0.;
VxEarth0=0.;
VyEarth0=2 π;
t0=0.;

Newton’s Laws

RxJupiter[t_] := RJcm Cos[ω t]
RyJupiter[t_] := RJcm Sin[ω t]
RxSun[t_] := -RScm Cos[ω t]
RySun[t_] := -RScm Sin[ω t]
REJ[t_,Rx_,Ry_] := Sqrt[(RxJupiter[t]-Rx)^2+(RyJupiter[t]-Ry)^2]
RES[t_,Rx_,Ry_] := Sqrt[(RxSun[t]-Rx)^2+(RySun[t]-Ry)^2]
Fx[t_, Rx_, Ry_] :=GMeMj(RxJupiter[t]-Rx)/REJ[t,Rx,Ry]^3 + GMeMs(RxSun[t]-Rx)/RES[t,Rx,Ry]^3
Fy[t_, Rx_, Ry_] := GMeMj(RyJupiter[t]-Ry)/REJ[t,Rx,Ry]^3+GMeMs(RySun[t]-Ry)/RES[t,Rx,Ry]^3

Function that plots the Earth’s trajectory for a given mass, up to a given time.

PlotTrajectory[Mj_,tMax_] := (SetJupiterMass[Mj]; {RxS, RyS, VxS, VyS} = NDSolveValue[{Rx'[t]== Vx[t],Ry'[t] == Vy[t], Vx'[t] == Fx[t, Rx[t], Ry[t]]/EarthMass, Vy'[t] ==Fy[t, Rx[t], Ry[t]]/EarthMass, Rx[0] ==RxEarth0, Ry[0] == RyEarth0, Vx[0] == VxEarth0, Vy[0] == VyEarth0},{Rx, Ry, Vx, Vy}, {t,0,tMax}]; ParametricPlot[{RxS[t],RyS[t]},{t,0,tMax}, PlotPoints->400,PlotStyle->Directive[Opacity[0.5]]])

Run for 100 years. Does it look like Jupiter is kicking Earth out of the solar system? Be sure to zoom in (say, to the top arc in the orbit). Estimate the fraction that the Earth’s radius from the Sun changes due to Jupiter’s varying gravitational pull.

trueMassOrbit = PlotTrajectory[TrueJupiterMass,100]
Show[trueMassOrbit, PlotRange->{{-0.2,0.2},{0.99,1.02}}, ImageSize->Full]

Maybe Jupiter just pulls the earth out and back depending on which side of the Sun it lies? We can check this by looking at Earth’s orbit in a rotating reference frame. (If vhat =[cos(ωt),sin(ωt)] is a unit vector pointing from the center of mass to Jupiter, and R is Earth’s position, we’re looking at vhat⋅R on the x-axis and vhat×R on the y-axis.) Now Jupiter is fixed at y=0, x∼5 Earth orbit radii. Zoom in on the part of the orbit where Earth is closest to Jupiter, and the segment at the top. Is the orbit now a simple closed curve, or is it still tubular in the rotating frame?

PlotRotatingFrame[Mj_, tMax_] := (SetJupiterMass[Mj]; {RxS, RyS, VxS, VyS} = NDSolveValue[{Rx'[t]== Vx[t],Ry'[t] == Vy[t], Vx'[t] == Fx[t, Rx[t], Ry[t]]/EarthMass, Vy'[t] ==Fy[t, Rx[t], Ry[t]]/EarthMass, Rx[0] ==RxEarth0, Ry[0] == RyEarth0, Vx[0] == VxEarth0, Vy[0] == VyEarth0},{Rx, Ry, Vx, Vy}, {t,0,tMax}]; ParametricPlot[{RxS[t] Cos[ω t] + RyS[t] Sin[ω t],RyS[t] Cos[ω t] - RxS[t] Sin[ω t]},{t,0,tMax}, PlotPoints->400,PlotStyle->Directive[Opacity[0.5]]])

trueRot = PlotRotatingFrame[TrueJupiterMass, 12.];
Show[trueRot, PlotRange->{{-0.1,0.1},{0.99,1.02}}]
Show[trueRot, PlotRange->{{0.99,1.02},{-0.1,0.1}}]

The nth time Jupiter passes by, the Earth is shifted no further than the first time. Jupiter thus warps Earth’s orbit into a kind of spiral around a tube. This orbit in physical three-dimensional space is a projection of the tube in dimensional phase space. Jupiter thus warps Earth’s orbit into a kind of spiral around a tube. This orbit in physical three-dimensional space is a projection of the tube in 6N-dimensional phase space.

Now try increasing Jupiter’s mass to 31000 Earth masses. (The book says 35000, but it’s a little less fun.) What happens? What are the tiny loops? If you increase the time, does the Earth leave the Solar System?

PlotTrajectory[...,100.]

The tube in phase space already exists for massless planets...
Let us start in the non-interacting planet approximation (where Earth and Jupiter are assumed to have zero mass). Both Earth’s orbit and Jupiter’s orbit then become circles, or more generally ellipses. The field of topology does not distinguish an ellipse from a circle; any stretched, ‘wiggled’ rubber band is a circle so long as it forms a curve that closes into a loop. Similarly, a torus (the surface of a doughnut) is topologically equivalent to any closed surface with one hole in it (like the surface of a coffee cup, with the handle as the hole). Convince yourself in this non-interacting approximation that Earth’s orbit remains topologically a circle in its six-dimensional phase space.
In the non-interacting planet approximation, what topological surface is it that contains the trajectory of the Earth, Jupiter, and the Sun? Choose between (i) sphere, (ii) torus, (iii) Klein bottle, (iv) two-hole torus, or (v) complex projective plane. About how many times does the Earth wind around this surface during each Jovian year?

The mathematical understanding of the three-body problem was only solved in the past hundred years or so, by Kolmogorov, Arnol’d, and Moser. Their proof focuses on the topological integrity of this tube in phase space (called now the KAM torus). The KAM theorem tells us that the motion stays on a surface with the same topology even when Jupiter’s mass becomes non-zero -- but only if Jupiter’s year is a ‘sufficiently irrational’ number of Earth years. This protects the Earth from flying out of the solar system.
More specifically, they could prove in this case that for sufficiently small planetary masses there is a distorted torus in phase space, near the unperturbed one, around which the planets spiral around with the same winding number. About how large can you make Jupiter’s mass before Earth’s orbit stops looking like a torus? Admire the surface formed at large masses before the surface changes.

PlotTrajectory[...,1000.]

(You may find that there are regions of unstable motion followed by regions of stable tori, and the behavior depends on the initial condition; there is no single correct answer for the largest mass before the torus disappears. Also, if you look in the rotating frame, interesting things happen before the Earth departs the Solar System.)

We will explore these using a Poincaré section...

The fact that the motion is stabilized by this invariant surface is a serious problem for statistical mechanics! The orbit does not explore the entire allowed energy surface. Our climate would be very unpleasant, on the average, if our orbit were ergodic.
The Poincaré section shown in Fig. 4.8 in the text is a planar cross-section in a three-dimensional phase space. Can we reduce our problem to an interesting problem with three phase-space coordinates? The original problem has an eighteen-dimensional phase space. In the center of mass frame it has twelve interesting dimensions. If we restrict the motion to a plane, it reduces to eight dimensions. If we assume that the mass of the Earth is zero (the restricted planar three-body problem) we have five relevant coordinates (Earth xy positions and velocities, and the location of Jupiter along its orbit). If we remove one more variable by going to a rotating coordinate system that rotates with Jupiter, the current state of our model can be described with four numbers: two positions and two momenta for the Earth. We can remove another variable by confining ourselves to a fixed ‘energy’. The true energy of the Earth is not conserved (because Earth feels a periodic potential), but there is a conserved quantity which is like the energy in the rotating frame. This leaves us with a trajectory in three dimensions (so, for small Jovian masses, we have a torus embedded in a three-dimensional space). Finally, we take a Poincaré cross-section; we plot a point of the trajectory every time Earth passes directly between Jupiter and the Sun. We plot the distance to Jupiter along the horizontal axis, and the velocity component towards Jupiter along the vertical axis; the perpendicular component of the velocity is not shown (and is determined by the ‘energy’).
Let us use a Poincaré section to explore these tori and the chaotic regions between them. We want to take a snapshot of the position of the Earth each time it passes Jupiter. We need to interpolate between our trajectory points (using a spline), and find out where the snapshot times should be, and then report the corresponding positions. Rather than returning all four positions, we can go into the rotating frame and report the ‘radial’ position and velocity along the direction pointing to Jupiter. (The angular position is zero by the rules of the snapshot. The angular velocity is set by the total energy.)

PoincareIntersections[Mj_, tMax_]:= (SetJupiterMass[Mj]; Reap[NDSolve[{Rx'[t]== Vx[t],Ry'[t] == Vy[t], Vx'[t] == Fx[t, Rx[t], Ry[t]]/EarthMass, Vy'[t] ==Fy[t, Rx[t], Ry[t]]/EarthMass, Rx[0] ==RxEarth0, Ry[0] == RyEarth0, Vx[0] == VxEarth0, Vy[0] == VyEarth0},{Rx, Ry, Vx, Vy}, {t,0,tMax}, Method->{"EventLocator", "Event"->Sin[ω t] Rx[t]-Cos[ω t] Ry[t], "Direction"->-1, "EventAction":> Sow[{Cos[ω t]Rx[t] +Sin[ω t] Ry[t], Cos[ω t]Vx[t] +Sin[ω t] Vy[t]}]}]][[2]][[1]])

Note that the “Event” we look for is where the cross product of Jupiter’s direction (cos[ω t], sin[ω t]) and Earth’s direction (Rx,Ry) is zero, going from plus to minus.  When that happens, we ‘Sow’ the ‘radial’ position and velocity of Earth along Jupiter’s direction.

Try a Poincaré plot for Jupiter’s true mass.

ListPlot[PoincareIntersections[TrueJupiterMass, 500], AxesLabel->{Rx, Vx}]

Notice that the trajectory forms a closed curve. This curve is the intersection of a KAM torus with the Poincaré cross section. Does the range of r coordinates roughly correspond to the range of maximum x-coordinates you saw in the rotating reference frame for the true Jupiter mass above?

Try a Poincaré plot for a mass of 22000.

ListPlot[PoincareIntersections[22000., 5000.], AxesLabel->{Rx,Vx}]

This time we have something that looks like three closed curves, but is noticeably irregular. Something is very roughly repeating every third time Earth crosses Jupiter’s angle. It represents the Earth in ‘resonance’ with Jupiter -- every third time it crosses Jupiter’s angle, it returns roughly to the same point. (Resonances are often associated with ‘mode locking’, where the Earth’s year becomes an integer multiple of Jupiter’s year.) The irregularity, we shall see, is a sign of chaotic motion -- something that happens near resonances.
The trajectory in the rotating reference frame also looks funky.

PlotRotatingFrame[22000.,500.]

Would other initial conditions, with this same mass, look maybe more like the original KAM torus? (After all, you found trajectories for larger Jupiter masses that looked like tori earlier: 22000 is a weird interlude with mode locking.) To test this, we want to launch many trajectories at the same ‘energy’ (the conserved integral of motion in the rotating reference frame).

RotatingFrameEnergy[Rx_, Ry_, Vx_, Vy_,t_]:=Block[{KineticEnergy=0.5EarthMass(Vx^2+Vy^2)+EarthMass ω (Vx Ry-Vy Rx),
PotentialEnergy=-GMeMj/REJ[t,Rx,Ry]-GMeMs/RES[t,Rx,Ry]},
PotentialEnergy+KineticEnergy]

Just to check, for the default initial conditions and true Jupiter mass, the rotating frame energy is around -22.88...

SetJupiterMass[TrueJupiterMass]; RotatingFrameEnergy[RxEarth0, RyEarth0, VxEarth0, VyEarth0, t0]

We define a function that, given the two coordinates r_radial and v_radial we plot on the Poincaré section, gives initial conditions that launch the Earth with the current energy in the right direction.

EnergySurfaceInitial[Rx_, Vx_, CurrentEnergy_]:= Block[{Vy,PotentialEnergy = -GMeMj/Abs[RJcm-Rx]-GMeMs /Abs[-RScm-Rx],
c = -CurrentEnergy + PotentialEnergy + 0.5 EarthMass Vx^2,
discriminant = ω^2 Rx^2 - 2 c/EarthMass},
If[discriminant>0,(Vy=ω Rx + Sqrt[discriminant]; {Rx,0.,Vx,Vy}), (Print["VERBOTEN"]; {})]]

Test it by seeing if it gives the right initial y-velocity for the default initial conditions and true Jupiter mass. Do they look familiar?

SetJupiterMass[TrueJupiterMass]; CurrentEnergy = RotatingFrameEnergy[RxEarth0, RyEarth0, VxEarth0, VyEarth0, t0]
EnergySurfaceInitial[RxEarth0,VxEarth0, CurrentEnergy]

We now define a function that takes a mouse click event on the plot (RxVx = {Rx, Vx} giving the radial  position and radial velocity of the earth), launches a trajectory with that initial condition on the energy surface, and returns the Poincaré intersections for that trajectory.

PoincareLauncher[RxVx_,tMax_, CurrentEnergy_]:= 
(RV = EnergySurfaceInitial[RxVx[[1]], RxVx[[2]],CurrentEnergy];
If[Length[RV]==0,Print["Verboten in Poincare Points"],
{Rx0, Ry0, Vx0, Vy0 } = RV;
(* Note that we store the trajectories for later use *)
{{Trajectories}, newPoints} = Reap[NDSolve[{Rx'[t]== Vx[t],Ry'[t] == Vy[t], Vx'[t] == Fx[t, Rx[t], Ry[t]]/EarthMass, Vy'[t] ==Fy[t, Rx[t], Ry[t]]/EarthMass, Rx[0] ==Rx0,Ry[0] == Ry0, Vx[0] == Vx0, Vy[0] == Vy0},{Rx, Ry, Vx, Vy}, {t,0,tMax}, Method->{"EventLocator", "Event"->Sin[ω t] Rx[t]-Cos[ω t] Ry[t], "Direction"->-1, "EventAction":> Sow[{Cos[ω t]Rx[t] +Sin[ω t] Ry[t], Cos[ω t]Vx[t] +Sin[ω t] Vy[t]}]}]]]; newPoints[[1]])

We can now use PoincareLauncher to form an interactive window that allows us to explore the dynamics as a function of the initial condition. Click on the plot and see new orbits launched! Compare the Poincaré intersection rings with the corresponding full orbits.

SetJupiterMass[22000.];
tMax=1000.;
CurrentEnergy = RotatingFrameEnergy[RxEarth0,RyEarth0,VxEarth0,VyEarth0,t0];
initialPoints = PoincareLauncher[{RxEarth0,VxEarth0}, tMax, CurrentEnergy];
DynamicModule[{xVxs={initialPoints}},ClickPane[Dynamic@ListPlot[xVxs, ImageSize->Large, AxesLabel->{Rx,Vx}],AppendTo[xVxs, PoincareLauncher[#,tMax, CurrentEnergy]]&]]

To see the rotating reference frame for the latest initial conditions, execute the following commands. (We stored Rx, Ry, Vx, and Vy in the variable ‘Trajectories’ when we called PoincareLauncher. This is poor programming practice, to communicate between routines using global variables, but I haven’t figured out how to launch this plot when you click the above one in Mathematica.)

{RxS, RyS} = {Rx,Ry} /. Trajectories;
ParametricPlot[{RxS[t] Cos[ω t] + RyS[t] Sin[ω t],RyS[t] Cos[ω t] - RxS[t] Sin[ω t]},{t,0,tMax}, MaxRecursion->7, PlotPoints->400,PlotStyle->Directive[Opacity[0.5]]]

Click on points in the plot to launch new trajectories. Can you find an orbit that is periodic (returns to the same point after three crossings)? What do the orbits look like in the rotating reference frame? The orbits near this periodic orbit, forming a torus which winds in a four-fold pattern in the rotating reference frame, are called mode locked.
Can you find initial conditions that give KAM tori that are more like those for small Jupiter masses (that is, that intersect the Poincaré surface only once)? Do the orbits in the rotating reference frame look like deformed tori? (Notice that the KAM tori are squashed and twisted: they are topologically still tori.)
Can you find regions that look chaotic? Can you find a five-fold pattern in the rotating reference frame? Nine-fold?
Notice that the chaotic orbit does not throw the Earth out of the Solar System. The chaotic regions near infinity and near our initial condition are not connected. This may be an artifact of our low-dimensional model; in other larger systems it is believed that all chaotic regions (on a connected energy surface) are joined through Arnol’d diffusion.
It turns out that proving that Jupiter’s effects cancel out depends on Earth’s smoothly averaging over the surface of the torus. If Jupiter’s year is a rational multiple of Earth’s year, the orbit closes after a few years and you do not average over the whole torus; only a closed spiral. Rational winding numbers, we now know, lead to chaos when the interactions are turned on; the large chaotic region you found above is associated with an unperturbed orbit with a winding ratio of 3:1 (hence the three circles). Disturbingly, the rational numbers are dense; between any two KAM tori there are chaotic regions, just because between any two irrational numbers there are rational ones. It is even worse; it turns out that numbers which are extremely close to rational (Liouville numbers like 1+1/10+1/10^10+1/10^(10^10)+…) may also lead to chaos. It was amazingly tricky to prove that lots of tori survive nonetheless. You can imagine why this took hundreds of years to understand (especially without computers to illustrate the tori and chaos graphically).
Try other masses.

SetJupiterMass[20000.];
tMax=1000.;
CurrentEnergy = RotatingFrameEnergy[RxEarth0,RyEarth0,VxEarth0,VyEarth0,t0];
initialPoints = PoincareLauncher[{RxEarth0,VxEarth0}, tMax, CurrentEnergy];
DynamicModule[{xVxs={initialPoints}},ClickPane[Dynamic@ListPlot[xVxs, ImageSize->Large],AppendTo[xVxs, PoincareLauncher[#,tMax, CurrentEnergy]]&]]

{RxS, RyS} = {Rx,Ry} /. Trajectories;
ParametricPlot[{RxS[t] Cos[ω t] + RyS[t] Sin[ω t],RyS[t] Cos[ω t] - RxS[t] Sin[ω t]},{t,0,tMax}, MaxRecursion->7, PlotPoints->400,PlotStyle->Directive[Opacity[0.5]]]