Hamiltonian mechanics — pivoting to phase space
Hamiltonian mechanics — pivoting to phase space
The Legendre transform turns the Lagrangian into the Hamiltonian, the stage moves from the configuration space to the cotangent bundle , and motion is rewritten as first-order Hamilton equations.
Opening
Until now we drew motion on the tangent bundle of the configuration space — that is, with coordinates and velocities as variables, in the Lagrangian picture. This chapter swaps the stage. Replacing velocity with the conjugate momentum and moving onto the cotangent bundle , the equations of motion rewrite themselves as a symmetric first-order system. That one change of coordinates is the key that unlocks the canonical transformations of chapter 11, the Poisson bracket of chapter 12, and even the phase-space intuition of quantum mechanics.
Main 1 — Conjugate momentum and the Legendre transform
Given a Lagrangian , the conjugate momentum to the -th coordinate is
For a single particle with this is — the familiar linear momentum — but in general the meaning depends on the choice of coordinates (angular momentum for an angular coordinate, with extra correction terms in a rotating frame).
We now want to use as new coordinates rather than keeping as a function of . That requires solving the relation above for , and the condition that guarantees solvability is regularity: the Hessian
is invertible at every point. By the implicit function theorem we then get uniquely. Under this assumption we define the Hamiltonian as
(Einstein summation). This is the Legendre transform of with respect to — the classical move of swapping the graph of a function for the slopes of its tangent lines as the new coordinate.
Concretely, with we get , , and
namely the sum of kinetic and potential energy — the total energy. For simple systems the Hamiltonian is the energy, but in a rotating frame or with a magnetic field the two part ways; we revisit that distinction in chapter 12.
Main 2 — Hamilton’s equations and the phase space
Now rewrite the equations of motion in the new coordinates . Differentiating the definition of and using the Euler–Lagrange equations, the partial derivatives of deliver the motion directly.
These are Hamilton’s equations. The second-order ODEs of the Lagrangian side become first-order ODEs, and position and momentum enter almost symmetrically — up to a single sign.
The stage on which motion unfolds shifts too. If at each point the tangent vector lived in the tangent space , then the cotangent space is its dual — the space of linear functionals that send tangent vectors to real numbers. The conjugate momentum is naturally an element of . Assembling all the cotangent spaces over every gives a manifold called the cotangent bundle, and this is the phase space of Hamiltonian mechanics. Its dimension is when .
That is not just a twin of becomes clear in chapter 11. Phase space carries a coordinate-independent natural 2-form
inscribed on it (called the symplectic form), and Hamilton’s equations are the flow of the vector field that this and the function together produce. For now we only deposit the name; the next chapter, on canonical transformations, will show why this form is preserved.
Main 3 — Phase portrait of the pendulum
The strength of the Hamiltonian picture is that even when a nonlinear system has no closed-form integral, the picture is still drawable. Take the pendulum. The coordinate is the angle (a circle with the endpoints identified), and the conjugate momentum is . The Legendre transform of is
and since itself is conserved, every trajectory lives on a level curve . Three regimes appear depending on .
- : closed loops around the origin (the lower equilibrium) — oscillation.
- : a pair of curves asymptotic to the unstable equilibrium — the separatrix. Reaching it takes infinite time.
- : open curves winding monotonically in — rotation.
Solving for gives the separatrix . In units with this simplifies to . Compared with the same picture drawn in Lagrangian coordinates , the phase-space portrait makes one point obvious at a glance: the level curves of the conserved energy are the trajectories.
In Python
# Pendulum phase portrait: integrate Hamilton's equations with hand-rolled RK4
# and draw 15 trajectories in the (theta, p) plane. Dashed E=1 = separatrix.
import numpy as np
import matplotlib.pyplot as plt
def rhs(s): # Hamilton's eqs (m=l=g=1)
th, p = s # dH/dp = p, -dH/dth = -sin(th)
return np.array([p, -np.sin(th)])
def rk4_step(s, dt):
k1 = rhs(s)
k2 = rhs(s + 0.5 * dt * k1)
k3 = rhs(s + 0.5 * dt * k2)
k4 = rhs(s + dt * k3)
return s + dt * (k1 + 2*k2 + 2*k3 + k4) / 6
dt, T = 0.02, 20.0
N = int(T / dt)
fig, ax = plt.subplots(figsize=(7, 4))
for E in (0.2, 0.6, 1.0, 1.4, 1.8): # sweep energies on a grid
for th0 in (-2.0, 0.0, 2.0): # three initial angles
val = 2 * (E + np.cos(th0)) # p0^2 = 2(E + cos th0)
if val < 0: # skip energetically forbidden seeds
continue
s = np.array([th0, np.sqrt(val)])
traj = np.empty((N + 1, 2)); traj[0] = s
for n in range(N):
traj[n+1] = rk4_step(traj[n], dt)
ax.plot(traj[:, 0], traj[:, 1], lw=0.7)
th = np.linspace(-np.pi, np.pi, 400) # separatrix E=1
ax.plot(th, np.sqrt(2*(1 + np.cos(th))), "k--", lw=1)
ax.plot(th, -np.sqrt(2*(1 + np.cos(th))), "k--", lw=1)
ax.set_xlabel(r"$\theta$"); ax.set_ylabel(r"$p$"); plt.show()
Closed loops in the oscillation region, open curves drifting up or down in the rotation region, and the dashed separatrix dividing them — once all three appear on the same canvas, the phase-space picture is in hand.
To the next chapter
Chapter 11: Canonical transformations and the symplectic structure takes the symplectic form , dropped at the end of Main 2 with only its name, and asks how it behaves under changes of coordinates. Transformations that preserve are called canonical, and the fact that this single class of transformations preserves the form of Hamilton’s equations is what underwrites the Poisson bracket of chapter 12 and the Hamilton–Jacobi equation of chapter 13.