# 4. Elements of classical mechanics¶

## 4.1. Mechanics of a particle¶

Classical mechanics—as opposed to quantum mechanics—describes the motions of bodies under the influence of classical forces, such as gravitational or electromagnetic forces. The basic concepts are contained in Newton’s laws of motion. The time derivative of the location $$\vec{x}$$ of a body with mass $$m$$ is the velocity, $$\vec{v} = \dot{\vec{x}}$$ (from now on we will often write a time derivative of a quantity as a dot over that quantity, and $$n$$ time derivatives as $$n$$ dots). An important, related concept is that of the momentum $$\vec{p}$$ of the body:

$$\vec{p} = m\,\vec{v}\,.$$

Newton’s laws of motion are then the following:

Newton’s first law of motion: In an inertial reference frame, unless acted upon by a force, a body remains at rest or moving at a constant velocity.

Newton’s second law of motion: In an inertial reference frame, the vector sum of all forces $$\vec{F}$$ *acting on a body is equal to the change in the body’s momentum in time:

$$\label{eq-classmech-newton2} \dot{\vec{p}} = \vec{F}\,.$$

Newton’s third law of motion: If a body $$i$$ exerts a force $$\vec{F}_{ij}$$ on a body $$j$$, the second body simultaneously exerts a force $$\vec{F}_{ji} = -\vec{F}_{ij}$$ equal in magnitude and opposite in sign on the first body.

For bodies with a constant mass, which is typically the case in galactic dynamics, Newton’s second law as stated above reduces to the more familiar $$\vec{F} = m\,\vec{a}$$, with $$\vec{a} = \ddot{\vec{x}}$$ the acceleration.

Newton’s laws of motion hold in an inertial reference frame. Newton considered these frames to derive from the absolute frame of the fixed stars, which he assumed to be stationary, homogeneous, isotropic, and unchanging in time. A frame moving at a constant velocity with respect to an inertial frame is an inertial frame itself; the transformation between frames is given by the Galilean transformation. To Newton, inertial frames were therefore those frames that move at constant velocity with respect to the fixed stars. We now know that Newton’s assumptions about the “fixed stars” were mistaken: the stars visible in the night sky are distributed in a quite non-homogeneous manner in the Milky Way and they all move within it at a small, but measurable rate. Furthermore, the theory of general relativity and cosmological world models based on it demonstrate that there is not a single, absolute reference frame. Thus, the notion of an inertial reference frame is problematic. However, much like Newtonian mechanics and gravitation is an approximation to the more general theory of general relativity, the notion of an inertial reference frame is still useful in an approximate manner.

To a physicist’s mind, clearly what matters is the magnitude of the acceleration of the reference frame itself versus that of bodies whose motions are described with respect to the frame. For example, much of classical mechanics pertains to the motion of objects on Earth (e.g., a ball rolling down an incline, or a pendulum swinging) and we use local patches of the Earth, such as a small laboratory, as the inertial reference frame in these cases. Why can we do this? Because the acceleration of the laboratory itself is small compared to the accelerations of the bodies under study within the frame. The relevant acceleration of the lab frame is the centripetal acceleration due to the rotation of the Earth, which we can compute as

[3]:

from astropy import units, constants
print('{} m/s^2'.format(\
(constants.R_earth*(2.*numpy.pi/(1.*units.day))**2.)\
.to(units.m/units.s**2).value))

0.03373056189481955 m/s^2


This is much smaller than the acceleration due to gravity, which is $$9.80\,\mathrm{m\,s}^{-2}$$ (so the centripetal acceleration is about 300 times smaller). Therefore, to a good approximation, the acceleration due to the rotation of the Earth does not matter for simple laboratory experiments and we may consider the frame as an inertial frame within which Newton’s laws of motion hold.

Moving to larger scales, there is a similar hierarchy at play. In the solar system, typical accelerations are like that at the Earth’s orbit, which we may estimate from the centripetal acceleration implied by the distance (1 AU) and period (1 year) of the Earth’s orbit around the Sun:

[5]:

print('{} m/s^2'.format(\
(units.AU*(2.*numpy.pi/(1.*units.yr))**2.)\
.to(units.m/units.s**2).value))

0.0059303075202325715 m/s^2


The entire solar system is accelerated by the mass distribution in the Milky Way, and at the location of the Sun—approximately 8 kpc from the center close to the mid-plane of the disk—we can compute this acceleration approximately from the MWPotential2014 Milky-Way model in galpy (we calculate the acceleration in the midplane, where its only non-zero component is the radial one):

[6]:

from galpy.potential import MWPotential2014, evaluateRforces
print('{} m/s^2'.format(\
numpy.fabs(evaluateRforces(MWPotential2014,8.*u.kpc,0.*u.pc,
ro=8.,vo=220.)\
.to(units.m/units.s**2)).value))

1.9606714701292021e-10 m/s^2


This acceleration is thirty million times smaller than that experienced by the Earth from the Sun. Therefore, we may typically consider the center of mass of the solar system (the solar system barycenter) as an inertial frame for the purposes of solar-system dynamics.

The acceleration of the Milky Way barycenter from the mass distribution of local galaxies surrounding the Milky Way is another three orders of magnitude smaller. This is much smaller than the acceleration within the Milky Way, even at a hundred kpc from the center. The situation is similar for other isolated galaxies and we can therefore typically consider the internal dynamics in galaxies as taking place in an inertial reference frame centered on their barycenters. But like any approximation, this may break down when the external acceleration of the frame becomes closer to the magnitude of internal accelerations and in those cases the acceleration of the frame should be taken into account.

The motion of bodies innon-inertial reference frames can still be described in terms of forces and Newton’s laws of motion, but it is necessary to include fictitious forces to take the acceleration of the reference frame into account. Examples of these are the Coriolis force and the centrifugal force. We will come back to this when discussing the motion of bodies in a rotating reference frame.

A very important quantity in the study of galactic orbits is the angular momentum, defined as

$$\vec{L} = \vec{x}\times\vec{p}\,,$$

that is, the angular momentum is the cross product of the position and momentum vectors of a body. By taking the time derivative of the angular momentum, we can derive an equation for its evolution that is analogous to Newton’s second law:

\begin{align} \dot{\vec{L}} & = \frac{\mathrm{d} (\vec{x}\times\vec{p})}{\mathrm{d} t}\\ & = \dot{\vec{x}}\times\vec{p} + \vec{x}\times\dot{\vec{p}}\\ & = \vec{x}\times\vec{F}\,, \end{align}

where in going to the final line we have used that $$\dot{\vec{x}} = \vec{p}/m$$, that the cross product of a vector with itself is zero, and that $$\dot{\vec{p}} = \vec{F}$$ from Newton’s second law. The quantity $$\vec{x}\times\vec{F}$$ is the torque $$\vec{N}$$ and thus we have that

$$\dot{\vec{L}} = \vec{N}\,.$$

If the torque (or one of its components) is zero, the angular momentum (or one of its components) is conserved.

Another important mechanical concept is that of the work. The work $$W_{ij}$$ done by a force $$\vec{F}$$ in bringing a body from point $$\vec{x}_i$$ to point $$\vec{x}_j$$ is defined as

$$W_{ij} = \int_{\vec{x}_i}^{\vec{x}_j}\,\mathrm{d}\vec{x}\cdot\vec{F}\,.$$

Using Newton’s second law, we can show that the work is equal to (assuming that the mass $$m$$ of the body is constant)

$$W_{ij} = \int_{\vec{x}_i}^{\vec{x}_j}\,\mathrm{d}\vec{x}\cdot\vec{F} = m\int_{\vec{x}_i}^{\vec{x}_j}\,\mathrm{d}\vec{x}\cdot\dot{\vec{v}} = m\int_{\vec{x}_i}^{\vec{x}_j}\,\mathrm{d}t\,\vec{v}\cdot\dot{\vec{v}} = \frac{m|\vec{v}_j|^2}{2}-\frac{m|\vec{v}_i|^2}{2}\,.$$

We define the kinetic energy $$T$$ of a body as

$$T = \frac{m|\vec{v}|^2}{2} = \frac{m\,\vec{v}\cdot\vec{v}}{2}\,;$$

the work is then equal to the difference in kinetic energy: $$W_{ij} = T_j-T_i$$.

As we discussed in the previous chapter, the gravitational field is given by the gradient of a scalar function, the gravitational potential: $$\vec{F} = -m\,\nabla\Phi$$. In this case, the work can also be written as

$$W_{ij} = \int_{\vec{x}_i}^{\vec{x}_j}\,\mathrm{d}\vec{x}\cdot\vec{F} = -m\int_{\vec{x}_i}^{\vec{x}_j}\,\mathrm{d}\vec{x}\cdot\nabla\Phi = m\Phi(\vec{x}_i)-m\Phi(\vec{x}_j)\,,\label{eq-work-potential-conservative}$$

where the last equality follows from the gradient theorem and assumes that the force is independent of time; in this case the force is conservative. We then define the potential energy of a body in a gravitational field as $$V = m\Phi$$. The specific potential energy—the potential energy per unit mass—is simply equal to the gravitational potential.

Equating the expressions for the work in terms of the kinetic and potential energies, we have that

$$T_i + V(\vec{x}_i) = T_j + V(\vec{x}_j)\,.$$

The sum of the kinetic and potential energies of a body is the energy:

$$E = T + V\,.$$

The energy is conserved when the force is conservative. When the force explicitly depends on time, Equation $$\eqref{eq-work-potential-conservative}$$ only holds for instantaneous changes in position, that is, for constant time, and energy conservation therefore does not hold at different times. To see what happens to the energy, we can simply explicitly compute its time derivative

\begin{align} \dot{E} & = m\vec{v}\cdot\dot{\vec{v}} + m\nabla \Phi(\vec{x})\,\dot{\vec{x}}+m\frac{\partial \Phi(\vec{x})}{\partial t}\,\nonumber\\ & = m\vec{v}\cdot\dot{\vec{v}}-m\dot{\vec{v}}\cdot\vec{v} +m\frac{\partial \Phi(\vec{x})}{\partial t}\,\label{eq-energy-conserved}\\ & = m\frac{\partial \Phi(\vec{x})}{\partial t}\,.\nonumber\\ \end{align}

Thus, the total time derivative of the energy is mass times the partial time derivative of the gravitational potential. For a static potential, we recover the expected result that the energy is conserved.

## 4.2. Escape velocity¶

In most potentials, bodies that move fast enough can “escape” the gravitational field of a mass distribution. This means that such bodies do not orbit the center-of-mass of this mass distribution—because gravity is a long-range force, the gravitational field is technically felt even at extremely large distances. That the energy is conserved allows us to compute the escape velocity $$v_\mathrm{esc}$$: the minimum velocity necessary to “escape” the gravitational field, starting from position $$\vec{x}$$ to a resting position at $$r=\infty$$. The minimum velocity would cause the body to arrive at infinity with zero velocity, so energy conservation gives

$$\label{eq-vesc} \frac{v_\mathrm{esc}^2}{2} + \Phi(\vec{x}) = \frac{0^2}{2} + \Phi_\infty\,,$$

or

$$v_\mathrm{esc} = \sqrt{2[\Phi_\infty-\Phi(\vec{x})]}\,,$$

Because we normally try to define the potential such that $$\Phi_\infty=0$$, this typically simplifies to $$v_\mathrm{esc} = \sqrt{-2\Phi(\vec{x})}$$. For a spherical mass distribution, we have $$v_\mathrm{esc} = \sqrt{-2\Phi(r)}$$. Note that we have simply written $$\Phi_\infty$$ rather than specifying how we approach infinity; for a potential for which it is possible to escape, the potential at infinity cannot depend on the direction of infinity, so this is well defined.

Thus, the escape velocity measures the depth of the potential well. This means that the escape velocity contains information about the mass distribution outside of the radius at which it is measured, unlike the circular velocity, which only depends on the mass contained within the radius at which it is measured. This should be clear from the meaning of the “escape” velocity: the speed necessary for a body to escape must depend on the cumulative amount of gravitational attraction the body needs to overcome out to $$\infty$$. It is also clear from the expression for the gravitational potential in a spherical potential in Equation (3.28): the second term depends on the density outside of $$r$$.

In the Milky Way, it is possible to measure the escape velocity near the Sun by looking at the distribution of velocities and attempting to identify a high-velocity cut-off. The cut-off arises because stars at the escape velocity and beyond should be very rare, as they will escape the Galaxy and never return. This has been done with ever-increasing data from large-scale surveys measuring velocities for solar neighborhood stars (e.g., Leonard & Tremaine 1990; Smith et al. 2007; Piffl et al. 2014) with a local escape speed of $$v_\mathrm{esc} \approx 550\,\mathrm{km\,s}^{-1}$$ (we discuss this measurement in more detail in Chapter 7). We can get a rough estimate of the total mass of the Milky Way by comparing this measured escape velocity to the escape velocity that the Milky Way would have if all of its mass were within the solar orbit. We can use Newton’s second shell theorem to get the escape velocity in this case

$$v_\mathrm{esc}(r=8\,\mathrm{kpc}) = \sqrt{2\frac{GM(r<8\,\mathrm{kpc})}{8\,\mathrm{kpc}}}\,,$$

and substitute the estimate of $$M(r<8\,\mathrm{kpc})$$ from the simple estimate of the mass within the solar circle in Equation (3.34). This gives $$v_\mathrm{esc} = 311\,\mathrm{km\,s}^{-1}$$, well below the observed value of $$550\,\mathrm{km\,s}^{-1}$$. The expression for the gravitational potential in a spherical potential in Equation (3.28) demonstrates that we need to assume a density law outside of the solar orbit if we want to match the observed escape velocity (the potential outside of $$r$$ depends on $$\int_r^\infty\mathrm{d}r'\,\rho(r')\,r'$$, not on the mass directly). Let’s use the mass–radius relation that we derived from the fact that rotation curves are flat in Equation (3.35): $$\rho \propto r^{-2}$$. For this particular density law, the mass and potential do not converge as we go to $$r\rightarrow \infty$$, so let’s define the edge of the Milky Way as being at $$100\,\mathrm{kpc}$$ outside of which the density is zero (this is just a rough guess, given that we need to add lots of mass to explain the measured escape velocity; later we will see that the standard definition of “edge” gives a radius around $$250\,\mathrm{kpc}$$). Then we can show that the potential difference between $$r_\infty = 100\,\mathrm{kpc}$$ and $$r_0 = 8\,\mathrm{kpc}$$ is given in terms of the mass $$M(r<8\,\mathrm{kpc})$$ and the mass $$\Delta M$$ between $$r_0$$ and $$r_\infty$$

\begin{align} \Delta \Phi & = \Phi(r_\infty)-\Phi(r_0)\\ & = -G\,\left[\frac{M(r<8\,\mathrm{kpc})+\Delta M}{r_\infty}-\frac{M(r<8\,\mathrm{kpc})}{r_0}-\frac{\Delta M}{r_\infty-r_0}\,\ln (r_\infty/r_0)\right]\nonumber\,. \end{align}

Plugging this into $$v_\mathrm{esc} = \sqrt{2\Delta\Phi}$$ and using the enclosed mass from the simple estimate of the mass within the solar circle in Equation (3.34), we find that (this calculation can be simplified by assuming that $$M(r<8\,\mathrm{kpc}) \ll \Delta M$$)

$$\Delta M \approx 1.4\times 10^{12}\,M_\odot\,!$$

That the escape velocity near the Sun is approximately $$550\,\mathrm{km\,s}^{-1}$$ therefore implies that the total mass of the Milky Way must be $$\approx 10^{12}\,M_\odot$$, more than an order of magnitude larger than the mass we estimate to lie within the solar orbit. This simple estimate is remarkably accurate: a variety of complicated methods show that the Milky Way’s total mass is $$\approx 0.8$$ to $$1.6 \times 10^{12}\,M_\odot$$, in good agreement with our estimate. This mass is again much larger than the total mass that we see in stars and gas, again directly implying the presence of a large amount of dark matter in the Milky Way.

## 4.3. Lagrangian formulation of classical mechanics¶

While Newton’s second law of motion is familiar and intuitive, in the centuries after Newton proposed his laws, more powerful frameworks for expressing these laws were discovered. These are, for example, useful for working in different coordinate systems, including systems where positions and velocities get mixed up, they simplify the discussion of the equilibria of galactic systems, and they are helpful in designing efficient numerical algorithms for gravitational dynamics. These are all topics that we will discuss in the coming chapters. In this and the next section, we provide a brief overview of the tools of these alternative frameworks: Lagrangian and Hamiltonian mechanics.

The Lagrangian re-formulation of classical mechanics starts with Hamilton’s principle:

Hamilton’s principle: The motion of a system from time $$t_1$$ to time $$t_2$$ is such that the action integral

$$S = \int_{t_1}^{t_2}\mathrm{d}t \,L\,,$$

where $$L(\vec{x},\dot{\vec{x}},t) = T-V$$ is the Lagrangian, has an extremal value for the actual path of the system.

Using the Euler-Lagrange equation from the calculus of variations, we find that the trajectory is extremal if and only if

$$\frac{\mathrm{d}}{\mathrm{d} t}\left(\frac{\partial L}{\partial \dot{\vec{x}}}\right)-\frac{\partial L}{\partial \vec{x}} = 0\,.$$

Using the definition of the Lagrangian, kinetic, and potential energy, this is equivalent to

$$\frac{\mathrm{d}}{\mathrm{d} t}\left( m\dot{\vec{x}}\right) = - \frac{\partial V}{\partial \vec{x}} \,,$$

which is exactly Newton’s second law of motion. Thus, Hamilton’s principle is equivalent to Newton’s second law.

What makes Hamilton’s principle so powerful is that it involves scalar quantities (the action $$S$$ and the Lagrangian $$L$$) rather than the vector quantities (forces and momenta) that appear in Newton’s second law. This makes it far easier to derive the correct equations of motion in different coordinate systems, because it is typically more straightforward to re-write the Lagrangian in an alternative, generalized coordinate system $$(\vec{q},\dot{\vec{q}},t)$$ as $$L(\vec{q},\dot{\vec{q}},t)$$ than it is to directly transform Newton’s second (vector) law of motion to a different coordinate system. The Euler-Lagrange equation remains the same, and thus in a generalized coordinate system we the Lagrange equations

$$\label{eq-lagrange} \frac{\mathrm{d}}{\mathrm{d} t}\left(\frac{\partial L}{\partial \dot{\vec{q}}}\right)-\frac{\partial L}{\partial \vec{q}} = 0\,.$$

Working out this equation in an alternative coordinate system then directly provides the equations of motion.

As an example, we can derive the equations of motion for a three-dimensional system in cylindrical coordinates $$(R,\phi,z)$$ using the Lagrangian formalism. Because galaxies are close to axisymmetric (symmetric with respect to rotations around the direction of their angular momentum vector), cylindrical coordinates are often used to study galactic dynamics. Directly deriving these from Newton’s second law would require working out how to transform the acceleration to polar coordinates and how to compute the gradient in polar coordinates, which is quite tedious. However, in the Lagrangian formalism we simply write down the Lagrangian and use Equation $$\eqref{eq-lagrange}$$. In polar coordinates $$(R,\phi,z)$$ we have that (see Appendix A.1)

\begin{align} x & = R\,\cos \phi\,,\\ y & = R\,\sin \phi\,,\\ z & = z \end{align}

and that the velocities are

\begin{align} \dot{x} & = \dot{R}\,\cos \phi - R\,\dot{\phi}\,\sin \phi\,,\\ \dot{y} & = \dot{R}\,\sin \phi + R\,\dot{\phi}\,\cos \phi\,,\\ \dot{z} & = \dot{z}\,. \end{align}

The kinetic energy is therefore

$$\frac{m}{2}\,\left(\dot{x}^2 + \dot{y}^2 + \dot{z}^2\right) = \frac{m}{2}\,\left(\dot{R}^2 + R^2\,\dot{\phi}^2 + \dot{z}^2\right)\,,$$

and the Lagrangian is

$$L = T-V = \frac{m}{2}\,\left(\dot{R}^2 + R^2\,\dot{\phi}^2 + \dot{z}^2\right) - m\Phi(R,\phi,z)\,.$$

Equation $$\eqref{eq-lagrange}$$ applied to $$R$$, $$\phi$$, and $$z$$ then gives the equations of motion

\begin{align} \frac{\mathrm{d}}{\mathrm{d} t}\left(\frac{\partial L}{\partial \dot{R}}\right)-\frac{\partial L}{\partial R} & = 0\,,\\ \frac{\mathrm{d}}{\mathrm{d} t}\left(\frac{\partial L}{\partial \dot{\phi}}\right)-\frac{\partial L}{\partial \phi} & = 0\,,\\ \frac{\mathrm{d}}{\mathrm{d} t}\left(\frac{\partial L}{\partial \dot{z}}\right)-\frac{\partial L}{\partial z} & = 0\,, \end{align}

or

\begin{align} \ddot{R}- R\,\dot{\phi}^2& =-\frac{\partial \Phi}{\partial R} \,,\\ \frac{\mathrm{d}}{\mathrm{d} t}\left(R^2\,\dot{\phi}\right)& = -\frac{\partial \Phi}{\partial \phi}\,,\\ \ddot{z}& =-\frac{\partial \Phi}{\partial z} \,.\\ \end{align}

These are the equations of motion in cylindrical coordinates.

Because Newton’s second law relates the time derivative of the momentum to the force, in the Lagrangian formalism it makes sense to associate a generalized momentum $$\vec{p}$$ with generalized coordinates $$\vec{q}$$ as

$$\label{eq-gen-momentum} \vec{p} = \frac{\partial L}{\partial \dot{\vec{q}}}\,,$$

because the Euler-Lagrange equation then becomes

$$\label{eq-lagrange-in-terms-of-gen-momentum} \dot{\vec{p}} = \frac{\partial L}{\partial \vec{q}}\,.$$

This form is reminiscent of Newton’s second law. What this form of the Euler-Lagrange equation makes particularly clear is that if a generalized coordinate component $$q_j$$ does not appear in the Lagrangian, then its associated generalized momentum component is conserved. This means that an inspection of the Lagrangian in a well-chosen coordinate frame can reveal a system’s conserved quantities. This statement is closely related to Noether’s theorem, which states that if a system has a continuous symmetry property, then there are corresponding quantities whose values are conserved in time. For example, in the example of cylindrical coordinates above, if the potential does not depend on $$\phi$$, its associated momentum $$p_\phi = \partial L/\partial \dot{\phi} = mR^2\,\dot{\phi}$$ is conserved. The momentum $$p_\phi$$ is the $$z$$ component of the angular momentum in this case and it is conserved by virtue of the rotational symmetry of the potential. Note that the units of the generalized momentum are not necessarily the same as those of the regular, linear momentum $$\vec{p} = m\vec{v}$$. In the context of Hamiltonian mechanics, the generalized momentum is also known as the canonical momentum.

## 4.4. Hamiltonian mechanics¶

In the Lagrangian framework, the coordinate $$\vec{q}$$ has primacy: the Lagrangian $$L(\vec{q},\dot{\vec{q}},t)$$ and the Lagrange equations serve to provide a (typically) second-order equation of motion for $$\vec{q}$$, while the derivatives $$\dot{\vec{q}}$$ only appears as a convenient short-hand for the time derivative of $$\vec{q}$$, but without having much meaning in and of themselves. The Lagrangian formalism makes it straightforward to derive the equations of motion in a transformed set of coordinates $$\vec{q} = \vec{G}(\vec{x})$$ (where $$\vec{G}(\cdot)$$ is some vector-valued, invertible function). However, much is to be gained, both in understanding the structure of the theory of classical mechanics and in its practical application to galactic dynamics, by considering broader sets of transformations.

### 4.4.1. Hamilton’s equations¶

In Hamiltonian mechanics, this is achieved by upgrading the canonical momentum $$\vec{p}$$ to a prime ingredient of the theory on the same footing as the coordinate $$\vec{q}$$. Because the Lagrangian is a function of $$\vec{q}$$ and $$\dot{\vec{q}}$$, in practice this is accomplished by performing a Legendre transformation of the Lagrangian. A Legendre transformation of a differentiable function $$f(x,y)$$ of two variables where $$u = \partial f / \partial x$$ and $$v = \partial f / \partial y$$ is a transformation of the form

$$g = f - ux\,.$$

In terms of $$(x,y)$$ the differential of $$f$$ is

$$\mathrm{d}f = u\,\mathrm{d}x+v\,\mathrm{d}y\,.$$

The differential of the Legendre transformation $$g$$ is

$$\mathrm{d}g= \mathrm{d}f - u\,\mathrm{d}x - x\,\mathrm{d}u = -x\,\mathrm{d}u+v\,\mathrm{d}y\,.$$

Thus, the function $$g$$ is specified in terms of $$(u,y)$$ and we have that

\begin{align} x & = -\frac{\partial g}{\partial u}\,,\\ v & = \phantom{-}\frac{\partial g}{\partial y}\,,\\ \end{align}

We then obtain the Hamiltonian as the following Legendre transformation (remember that $$\vec{p} = \partial L / \partial \dot{\vec{q}}$$ from Equation $$[\ref{eq-gen-momentum}]$$)

$$\label{eq-hamiltonian-def-lagrangian} H(\vec{q},\vec{p},t) = \dot{\vec{q}}\,\vec{p}-L(\vec{q},\dot{\vec{q}},t)\,.$$

In this equation, $$\dot{\vec{q}}$$ is determined by $$\vec{q}$$, $$\vec{p}$$, $$t$$ and Equation $$\eqref{eq-gen-momentum}$$.

Why is the Hamiltonian a useful quantity to introduce? Because it leads to a new, and in some sense simpler set of equations of motion. The total derivative $$\mathrm{d}H$$ of the Hamiltonian can be written in two forms: simply using its own variables:

$$\label{eq-dH-own} \mathrm{d}H = \frac{\partial H}{\partial \vec{q}}\,\mathrm{d}\vec{q} + \frac{\partial H}{\partial \vec{p}}\,\mathrm{d}\vec{p} + \frac{\partial H}{\partial t}\,\mathrm{d}t\,,$$

and using its definition in terms of the Lagrangian in Equation $$\eqref{eq-hamiltonian-def-lagrangian}$$

\begin{align} \mathrm{d}H & = \vec{p}\,\mathrm{d}\dot{\vec{q}}+\dot{\vec{q}}\,\mathrm{d}\vec{p} - \frac{\partial L}{\partial \vec{q}}\,\mathrm{d}\vec{q} - \frac{\partial L}{\partial \dot{\vec{q}}}\,\mathrm{d}\dot{\vec{q}}-\frac{\partial L}{\partial t}\,\mathrm{d}t\\ & = - \frac{\partial L}{\partial \vec{q}}\,\mathrm{d}\vec{q} +\dot{\vec{q}}\,\mathrm{d}\vec{p}-\frac{\partial L}{\partial t}\,\mathrm{d}t\,,\label{eq-dH-L} \end{align}

where the cancellation happens because of Equation $$\eqref{eq-gen-momentum}$$. Equating the prefactors of each of the differentials in Equations $$\eqref{eq-dH-own}$$ and $$\eqref{eq-dH-L}$$ and using the Lagrange equations in the form of Equation $$\eqref{eq-lagrange-in-terms-of-gen-momentum}$$ then gives the following system of equations

\begin{align} \dot{\vec{q}} & = \phantom{-}\frac{\partial H}{\partial \vec{p}}\,,\\ \dot{\vec{p}} & = -\frac{\partial H}{\partial \vec{q}}\,, \end{align}

known as Hamilton’s equations, as well as

$$\frac{\partial H}{\partial t} = -\frac{\partial L}{\partial t}\,.$$

Hamilton’s equation is a set of equations of motion that is equivalent to the Lagrange equations, but it is clear that this set of equations treats coordinate $$\vec{q}$$ and momentum $$\vec{p}$$ on the same footing. Rather than having a set of second-order differential equations for $$\ddot{\vec{q}}$$, we now have a twice as large set of first-order differential equations for $$(\dot{\vec{q}},\dot{\vec{p}})$$.

The space spanned by $$\vec{q}$$ is known as configuration space, while that spanned by $$\vec{w} = (\vec{q},\vec{p})$$ is phase space. Phase space is the fundamental space of gravitational mechanics and Hamilton’s equations describe the dynamics in this space. For an $$N$$-dimensional configuration space, phase-space is $$2N$$ dimensional and Hamilton’s equations provide $$2N$$ first-order differential equations. The solution of this set of differential equations includes $$2N$$ integration constants, which can be related to the initial condition $$\vec{w}_0$$.

For a set of generalized coordinates that is related to $$\vec{x}$$ by a transformation that does not explicitly depend on time, it can be shown that the Hamiltonian is equal to the energy: $$H = T+V$$ (technically, this requires the potential to not depend on the velocities, which is the case for gravitational potentials). The total time derivative of the Hamiltonian is

$$\frac{\mathrm{d} H}{\mathrm{d} t} = \frac{\partial H}{\partial \vec{q}}\,\dot{\vec{q}}+\frac{\partial H}{\partial \vec{p}}\,\dot{\vec{p}} + \frac{\partial H}{\partial t} = \frac{\partial H}{\partial t}\,.$$

The first two terms cancel because of Hamilton’s equations. Thus, we have again that if the potential does not explicitly depend on time, the Hamiltonian, or energy, is conserved.

As an example of the Hamiltonian framework, we can compute the Hamiltonian for cylindrical coordinates, starting from the results in section 4.3 above. Recall that the Lagrangian was given by

$$L = T-V = \frac{m}{2}\,\left(\dot{R}^2 + R^2\,\dot{\phi}^2 \dot{z}^2 \right) - m\Phi(R,\phi,z)\,.$$

The generalized momenta are therefore

\begin{align} p_R = \frac{\partial L}{\partial \dot{R}} & = m\,\dot{R}\,,\\ p_\phi = \frac{\partial L}{\partial \dot{\phi}} & = m\,R^2\,\dot{\phi}\,,\\ p_z = \frac{\partial L}{\partial \dot{z}} & = m\,\dot{z}\,. \end{align}

We can then compute the Hamiltonian

\begin{align} H(R,\phi,z,p_R,p_\phi,p_z) & = \dot{R}\,p_R+\dot{\phi}\,p_\phi+\dot{z}\,p_z-L(\vec{q},\dot{\vec{q}},t)\\ & = \dot{R}\,p_R+\dot{\phi}\,p_\phi+\dot{z}\,p_z-\frac{m}{2}\,\left(\dot{R}^2 + R^2\,\dot{\phi}^2+\dot{z}^2\right) + m\Phi(R,\phi,z)\\ & = \frac{1}{2m}\,\left(p_R^2 + \frac{p_\phi^2}{R^2}+p_z^2\right) + m\Phi(R,\phi,z)\,.\label{eq-hamiltonian-cylin} \end{align}

The Hamiltonian in two-dimensional polar coordinates is similarly

\begin{align} H(R,\phi,p_R,p_\phi) & = \frac{1}{2m}\,\left(p_R^2 + \frac{p_\phi^2}{R^2}\right) + m\Phi(R,\phi)\,.\label{eq-hamiltonian-polar} \end{align}

### 4.4.2. Canonical transformations¶

Just like the Lagrange equations can be derived from a variational principle (see section 4.3 above) and this is useful in generalizing Newton’s second law to arbitrary configuration-space coordinate frames, Hamilton’s equations can be derived from a variational principle. Hamilton’s principle above states that the motion of a system in configuration space $$\vec{q}$$ between times $$t_1$$ and $$t_2$$ is such that the action integral, $$S = \int_{t_1}^{t_2}\mathrm{d}t \,L(\vec{q},\dot{\vec{q}},t)$$ has a extremal value for the actual path of the system. To obtain a variational-principle formulation of Hamiltonian mechanics, we upgrade the path from a path in configuration space $$\vec{q}$$ to a path in phase space $$(\vec{q},\vec{p})$$ and replace the Lagrangian with its equivalent in terms of the Hamiltonian using Equation $$\eqref{eq-hamiltonian-def-lagrangian}$$. This gives the

Modified Hamilton’s principle: The trajectory of a system from time $$t_1$$ to time $$t_2$$ in phase space $$(\vec{q},\vec{p})$$ is such that the integral

$$\int_{t_1}^{t_2}\mathrm{d}t \,\left(\dot{\vec{q}}\,\vec{p}-H(\vec{q},\vec{p},t)\right)\,,$$

where $$H(\vec{q},\vec{p},t)$$ is the Hamiltonian, has an extremal value for the actual path of the system.

The Euler-Lagrange equations applied to this integral directly lead to Hamilton’s equations.

One may then ask what the most general set of transformations of phase-space

\begin{align} \vec{q}' & = \vec{q}'(\vec{q},\vec{p},t)\,,\\ \vec{p}' & = \vec{p}'(\vec{q},\vec{p},t)\,, \end{align}

is such that the dynamics of $$(\vec{q}',\vec{p}')$$ is given by Hamilton’s equations for some Hamiltonian $$K$$:

\begin{align} \dot{\vec{q}'} & = \phantom{-}\frac{\partial K}{\partial \vec{p}'}\,,\\ \dot{\vec{p}'} & = -\frac{\partial K}{\partial \vec{q}'}\,. \end{align}

These equations would hold if the path of the system is an extremum of the following integral in the modified Hamiton’s principle

$$\int_{t_1}^{t_2}\mathrm{d}t \,\left(\dot{\vec{q}'}\,\vec{p}'-K(\vec{q}',\vec{p}',t)\right)\,.$$

The path of the system in the transformed phase-space coordinates is an extremum if and only if

$$\lambda\,\left(\dot{\vec{q}}\,\vec{p}-H(\vec{q},\vec{p},t)\right) = \dot{\vec{q}'}\,\vec{p}'-K(\vec{q}',\vec{p}',t) + \frac{\mathrm{d} F}{\mathrm{d}t}\,,$$

because the path in the original coordinates is an extremum. The final term on the right-hand side is the total derivative of an arbitrary function of the phase-space coordinates and it is there because we can always add a total derivative, as this does not vary at the ends of the trajectory. The $$\lambda$$ parameter can be set to 1, because it can be absorbed by a change of units of $$(\vec{q}',\vec{p}')$$ and the transformation is therefore specified by

$$\label{eq-condition-canonical-transformation} \dot{\vec{q}}\,\vec{p}-H = \dot{\vec{q}'}\,\vec{p}'-K + \frac{\mathrm{d} F}{\mathrm{d}t}\,.$$

Transformations that satisfy this relation are canonical transformations. The function $$F$$ is called the generating function, because when expressed as a function of a mix of either of the configuration and momentum components of the old and new coordinates (so, e.g., $$(\vec{q},\vec{p}')$$ or $$(\vec{q}',\vec{p})$$, but not $$(\vec{q},\vec{p})$$ or $$(\vec{q}',\vec{p}')$$) it (implicitly) generates the transformation equations between the old and new phase-space coordinates. For example, consider $$F = F_1(\vec{q},\vec{q}',t)$$. Then Equation $$\eqref{eq-condition-canonical-transformation}$$ can be written out as

\begin{align} \dot{\vec{q}}\,\vec{p}-H & = \dot{\vec{q}'}\,\vec{p}'-K + \frac{\mathrm{d} F_1(\vec{q},\vec{q}',t)}{\mathrm{d}t}\\ & = \dot{\vec{q}'}\,\vec{p}'-K + \frac{\partial F_1}{\partial t} + \frac{\partial F_1}{\partial \vec{q}}\,\dot{\vec{q}} + \frac{\partial F_1}{\partial \vec{q}'}\,\dot{\vec{q}}'\,. \end{align}

Because this equation must hold everywhere and $$\vec{q}$$ and $$\vec{q}'$$ are independent, we must have that

\begin{align}\label{eq-gen1stkind-transform-1} \vec{p} & = \phantom{-}\frac{\partial F_1}{\partial \vec{q}}\,,\\ \vec{p}' & = -\frac{\partial F_1}{\partial \vec{q}'}\,.\label{eq-gen1stkind-transform-2} \end{align}

The new Hamiltonian $$K$$ is then also related to the old Hamiltonian $$H$$ through

$$\label{eq-canonical-hamiltonian-transform} K = H + \frac{\partial F_1}{\partial t}\,.$$

Equations $$\eqref{eq-gen1stkind-transform-1}$$ and $$\eqref{eq-gen1stkind-transform-2}$$ make it clear that the transformation defined by the generating function is an implicit transformation: we can compute one of the new and one of the old coordinates using the transformation equations, not both of the new or both of the old components.

We labeled the function as $$F_1$$ in the example above, because when the generating function depends on the configuration coordinate of both the old and the new coordinate system the function is a generating function of the first kind. In total, there are four different types of generating functions, one for each of the combinations of (old,new) and (configuration,momentum)-component. These lead to slightly different transformation equations that are easily derived in the same manner as for $$F_1(\vec{q}\,\vec{q}'t)$$ above. For example, a generating function of the second kind is a function $$F_2(\vec{q},\vec{p}')$$ such that in Equation $$\eqref{eq-condition-canonical-transformation}$$ $$F = F_2(\vec{q},\vec{p}') - \vec{q}'\,\vec{p}$$. Substituting this into Equation $$\eqref{eq-condition-canonical-transformation}$$ gives the transformation equations

\begin{align}\label{eq-gen2ndkind-transform-1} \vec{p} & = \frac{\partial F_2}{\partial \vec{q}}\,,\\ \vec{q}' & = \frac{\partial F_2}{\partial \vec{p}'}\,.\label{eq-gen2ndkind-transform-2} \end{align}

Useful exercises are to show that (a) the generating function of the second kind $$F_2(\vec{q},\vec{p}') = \vec{q}\cdot\vec{p}'$$ generates the identity transformation $$(\vec{q},\vec{p}) \rightarrow (\vec{q},\vec{p})$$ and (b) that the transformation generated by $$F_2(\vec{q},\vec{p}') = \vec{f}(\vec{q})\,\vec{p}'$$ is that which performs the coordinate transformation $$\vec{q} \rightarrow \vec{q}' = \vec{f}(\vec{q})$$. All configuration-space coordinate transformations are thus canonical; in the context of canonical transformations, they are also known as point transformations.

One important aspect of canonical transformations is that they have various useful invariants. If we consider canonical transformations that do not explicitly depend on time, we can show that the phase-space volume $$|\mathrm{d}\vec{q}\,\mathrm{d}\vec{p}|$$ is invariant. The transformation of an infinitesimal volume is given by the absolute value of the Jacobian of the transformation

$$\label{eq-transform-phasespace-volume} |\mathrm{d}\vec{q}'\,\mathrm{d}\vec{p}'| = \left| \begin{matrix} \frac{\partial \vec{q}'}{\partial \vec{q}} & \frac{\partial \vec{q}'}{\partial \vec{p}}\\ \frac{\partial \vec{p}'}{\partial \vec{q}} & \frac{\partial \vec{p}'}{\partial \vec{p}}\end{matrix}\right|\, |\mathrm{d}\vec{q}\,\mathrm{d}\vec{p}|\,.$$

For a canonical transformation that does not explicitly involve time, the Hamiltonian does not change: $$K = H$$ (see Equation $$[\ref{eq-canonical-hamiltonian-transform}]$$). Therefore, we can compute the time derivative of $$\vec{q}'$$ explicitly through partial differentiation through the canonical transformation and using Hamilton’s equations for the original coordinates:

\begin{align} \dot{\vec{q}}' & = \frac{\partial \vec{q}'}{\partial \vec{q}}\,\dot{\vec{q}}+\frac{\partial \vec{q}'}{\partial \vec{p}}\,\dot{\vec{p}}\\ & = \frac{\partial \vec{q}'}{\partial \vec{q}}\,\frac{\partial H}{\partial \vec{p}}-\frac{\partial \vec{q}'}{\partial \vec{p}}\,\frac{\partial H}{\partial \vec{q}}\,, \end{align}

and, alternatively, through Hamilton’s equations for the transformed coordinates and partial differentiation of the inverse transformation

\begin{align} \dot{\vec{q}}' & = \frac{\partial H}{\partial \vec{p}'} \\ & = \frac{\partial H}{\partial \vec{q}} \,\frac{\partial \vec{q}}{\partial \vec{p}'} +\frac{\partial H}{\partial \vec{p}} \,\frac{\partial \vec{p}}{\partial \vec{p}'}\,. \end{align}

For these two alternatives to give the same result, we must have that

\begin{align} \frac{\partial \vec{q}'}{\partial \vec{q}} & = \phantom{-}\frac{\partial \vec{p}}{\partial \vec{p}'}\\ \frac{\partial \vec{q}'}{\partial \vec{p}} & = -\frac{\partial \vec{q}}{\partial \vec{p}'}\,. \end{align}

Similarly, from working out $$\dot{\vec{p}}'$$ in two ways, we find that

\begin{align} \frac{\partial \vec{p}'}{\partial \vec{q}} & = -\frac{\partial \vec{p}}{\partial \vec{q}'}\\ \frac{\partial \vec{p}'}{\partial \vec{p}} & = \phantom{-}\frac{\partial \vec{q}}{\partial \vec{q}'}\,. \end{align}

If we substitute these expressions into the Jacobian in Equation $$\eqref{eq-transform-phasespace-volume}$$, we find that (using the fact that we can bring signs out of the Jacobian)

$$\left| \begin{matrix} \frac{\partial \vec{q}'}{\partial \vec{q}} & \frac{\partial \vec{q}'}{\partial \vec{p}}\\ \frac{\partial \vec{p}'}{\partial \vec{q}} & \frac{\partial \vec{p}'}{\partial \vec{p}}\end{matrix}\right| = \left| \begin{matrix} \frac{\partial \vec{p}}{\partial \vec{p}'} & \frac{\partial \vec{q}}{\partial \vec{p}'}\\ \frac{\partial \vec{p}}{\partial \vec{q}'}& \frac{\partial \vec{q}}{\partial \vec{q}'}\end{matrix}\right|$$

The determinant on the right-hand side is the determinant of the inverse transformation, which is equal to the inverse of the determinant of the original transformation. Therefore, we have that the determinant is equal to its own inverse and, thus, has to equal one (or minus one, but we are considering the absolute value, which is one either way). This means that Equation $$\eqref{eq-transform-phasespace-volume}$$ simplifies to

$$|\mathrm{d}\vec{q}'\,\mathrm{d}\vec{p}'| = |\mathrm{d}\vec{q}\,\mathrm{d}\vec{p}|\,.$$

Phase-space volume is thus conserved by canonical transformations.

### 4.4.3. The Hamilton-Jacobi equation and action-angle coordinates¶

Because Hamiltonian mechanics and the canonical-transformation formalism allow transformations to phase-space coordinate systems that mix traditional configuration and momentum variables, they can be used to separate dynamical systems into conserved quantities and non-conserved quantities. Using the definition of a canonical transformation above, we can seek a transformation characterized by a generating function of the second kind $$S(\vec{q},\vec{p}',t)$$ such that the Hamiltonian $$K$$ for the transformed coordinates is equal to zero. When this is the case, Hamilton’s equations for the transformed coordinates are simply

\begin{align}\label{eq-hamilton-jacobi-ideal-eqs} \dot{\vec{q}}' & = \phantom{-}\frac{\partial K}{\partial \vec{p}'} = 0\\ \dot{\vec{p}}' & = -\frac{\partial K}{\partial \vec{q}'} = 0\,.\\ \end{align}

Thus, the transformed coordinates are all conserved and the solution of the equations of motion is trivial. To obtain these simple equations, we require $$K = 0$$ or from Equation $$\eqref{eq-canonical-hamiltonian-transform}$$

$$\label{eq-classmech-HJ-inE} H\left(\vec{q},\frac{\partial S}{\partial \vec{q}},t\right) + \frac{\partial S}{\partial t} = 0\,.$$

This is the Hamilton-Jacobi equation and the generating function $$S$$ is Hamilton’s principal function. This is a first-order partial differential equation in $$N+1$$ variables $$(\vec{q},t)$$ and its solution is characterized by $$N+1$$ constants of integration $$C_i$$, one of which is simply a constant addition to $$S$$ that is irrelevant because $$S$$ only appears in the dynamical problem through its derivative. Because the other $$N$$ constants $$C_i$$ fully characterize the solution, we can express $$S$$ as a function $$S(\vec{q},\vec{C},t)$$ and, thus, we can set the transformed momentum $$\vec{p} = \vec{C}$$. That is, the transformed momentum is simply the set of $$N$$ integration constants.

If the Hamiltonian does not explicitly depend on time, $$H$$ and the energy are conserved. The function $$S$$ can then be separated as $$S(\vec{q},\vec{p}',t) = W(\vec{q},\vec{p}')-Et$$ and one of the $$C_i$$, say $$C_0$$, equals $$E$$. The Hamilton-Jacobi equation then simplifies to

$$H\left(\vec{q},\frac{\partial W}{\partial \vec{q}}\right)= C_0 = E\,,$$

where $$W(\vec{q},\vec{p}')$$ is Hamilton’s characteristic function. Solving the Hamilton-Jacobi equation for general systems—galactic or otherwise—is difficult. The only systems for which it is practical to solve the Hamilton-Jacobi equation are those for which the equation can be solved using additive separation of variables. That is, systems for which one can show that $$S(\vec{q})$$ along a dynamical trajectory can be written as a sum over functions of a single component: $$S = \sum_i S_i(q_i)$$. For example, for a two-dimensional system with a potential that only depends on $$R$$, we can write the Hamilton-Jacobi equation in polar coordinates using the expression for the Hamiltonian from Equation $$\eqref{eq-hamiltonian-polar}$$

$$\frac{1}{2m}\,\left[\left(\frac{\partial W}{\partial R}\right)^2 + \frac{1}{R^2}\,\left(\frac{\partial W}{\partial \phi}\right)^2\right] + m\Phi(R) = E\,,$$

which we can separate as $$W(R,\phi; \vec{C}) = W_\phi(\phi) + W_R(R)$$ as (we sometimes drop the argument $$\vec{C}$$ for notational simplicity)

$$\left(\frac{\partial W_\phi(\phi)}{\partial \phi}\right)^2 = 2m\,R^2\,\left[E-m\Phi(R)\right]-R^2\,\left(\frac{\partial W_R(R)}{\partial R}\right)^2\,.$$

The left-hand side only depends on $$\phi$$, while the right-hand side only depends on $$R$$, so they need to be separately conserved and equal to a separation constant, which is $$mR^2\,L_z^2$$ ($$L_z$$ is the conserved, specific angular momentum). The full solution of the Hamilton-Jacobi equation in this case is then (we assume that the trajectory is closed, such that it has finite bounds in each coordinate)

$$\label{eq-Wfunction-polar-coordinates} W(R,\phi;\vec{C}) = W_\phi(\phi) + W_R(R) = \int_0^\phi\mathrm{d}\phi\,L_z + \int_{R_\mathrm{min}}^R\mathrm{d}R\,\sqrt{2m\,\left[E-m\Phi(R)\right]-\frac{L_z^2}{R^2}}\,.$$

When we solve the Hamilton-Jacobi equation through separation of variables, we can write the solution in a form like this. Rather than using the set of integration constants $$\vec{C}$$ as the transformed momentum, we can then instead choose to use the $$N$$ quantities $$J_i$$ defined as

$$\label{eq-actions-definition} J_i = \frac{1}{2\pi}\,\oint \mathrm{d}q_i\,\frac{\partial W_{q_i}(q_i;\vec{C})}{\partial q_i}\,,$$

as the momentum. Because the only non-constant of the motion, the $$q_i$$, on the right-hand side are integrated over, it is clear that $$\vec{J}$$ is a function of the integration constants $$\vec{C}$$ alone, $$\vec{J}\equiv \vec{J}(\vec{C})$$, and they are thus constants of the motion as well. Because $$C_0 = H$$, from the inverse transformation we have that $$H \equiv H(\vec{J})$$, that is, the Hamiltonian is a function of the $$\vec{J}$$ only, not of its associated configuration coordinates. Considering $$W$$ as a function of $$(\vec{q},\vec{J})$$ instead of of $$(\vec{q},\vec{C})$$ then defines a new canonical transformation—one for which the very simple dynamics of Equation $$\eqref{eq-hamilton-jacobi-ideal-eqs}$$ no longer holds. The transformed configuration coordinates are now

$$\boldsymbol\theta = \frac{\partial W(\vec{q},\vec{J})}{\partial \vec{J}} = \sum_i \frac{\partial W_i(q_i,\vec{J})}{\partial J_i}\,.$$

Because $$W$$ still does not depend on time, the Hamiltonian to be used in Hamilton’s equations for this new set of coordinates $$(\boldsymbol\theta,\vec{J})$$ is the same and, as discussed above, we have that $$H \equiv H(\vec{J})$$. Therefore, the time evolution is given by

\begin{align} \dot{\boldsymbol\theta} & = \phantom{-}\frac{\partial H(\vec{J})}{\partial \vec{J}} = \mathrm{constant}\,,\\ \dot{\vec{J}} & = -\frac{\partial H(\vec{J})}{\partial \boldsymbol\theta} = 0\,.\\ \end{align}

Thus, while the dynamics is slightly more complicated than the ideal of Equation $$\eqref{eq-hamilton-jacobi-ideal-eqs}$$, the dynamics is still quite simple: the $$\vec{J}$$ are constant and the $$\boldsymbol\theta$$ increase linearly in time. Phase-space volume is conserved by a canonical transformation and for a separable system, this has to hold for each area spanned by a single component of configuration $$\theta_i$$ and $$J_i$$. We can then re-write the definition of the action as

\begin{align} J_i & = \frac{1}{2\pi}\,\iint \mathrm{d}q_i\,\mathrm{d}p_i\\ & = \frac{1}{2\pi}\,\iint \mathrm{d}\theta_i\,\mathrm{d}J_i\\ & = \frac{1}{2\pi}\,\oint \mathrm{d}\theta_i\,J_i\\ & = \frac{\Delta \theta_i}{2\pi}\,J_i\,, \end{align}

where $$\Delta \theta_i$$ is the range spanned by the $$\theta_i$$ variable. Each $$\theta_i$$ component therefore spans $$2\pi$$ and these variables are therefore known as angle variables. The $$J_i$$ are action variables and the set $$(\boldsymbol\theta,\vec{J})$$ are angle-action coordinates or action-angle coordinates. The rate at which the angles increase, $$\boldsymbol\Omega = \partial H(\vec{J})/\partial \vec{J}$$ are the frequencies. The action variables are called the “actions” because of their relation to the action in Hamilton’s principle. The total time derivative of Hamilton’s principal function $$S$$ is equal to the Lagrangian

\begin{align} \frac{\mathrm{d}S}{\mathrm{d}t} & = \sum_i \frac{\partial S}{\partial q_i}\,\dot{q}_i + \frac{\partial S}{\partial t}\\ & = \sum_i p_i\,\dot{q}_i -H\\ & = L\,. \end{align}

The integral of $$S$$ is therefore equal to the integral of the Lagrangian, or the action in Hamilton’s principle, up to an additive constant. Equation $$\eqref{eq-Wfunction-polar-coordinates}$$ and $$\eqref{eq-actions-definition}$$ demonstrate that the important part of $$S$$ in the case of time-independent Hamiltonians, the function $$W$$, is made up of integrals that are the same as those defining the actions, but over different ranges. Thus, the actions and the action are intimately related.

Why are the Hamilton-Jacobi equation and action-angle coordinates important in galactic dynamics? Because the Hamilton-Jacobi equation can only be solved in special cases, specific solutions only have limited usefulness (although these do include all spherical potentials and the $$\phi$$ dynamics in an axisymmetric potential, so they are not entirely useless). But Hamilton-Jacobi theory is important in the context of astrophysical dynamics, because it makes it clear that for any system and trajectory for which the Hamilton-Jacobi equation could in principle be solved—these are called regular orbits—bound orbits have three integrals of the motion, which could be chosen to be the actions, and an orbit is essentially a libration in three two-dimensional subspaces that is similar to the libration of a pendulum. For galactic orbits, these are the following three librations: (a) a rotation around the center of the mass distribution, in cylindrical coordinates associated with the angle $$\phi$$, (b) a radial oscillation towards and away from the center of the mass distribution, and (c) an oscillation perpendicular to an average orbital plane (in a disk galaxy this would be the galaxy’s mid-plane). The actions, when they can be computed or estimated, quantify the oscillation amplitude in these three different directions and therefore immediately tell us much about the characteristics of an orbit. Because an orbit is the combination of three oscillatory motions, it is equivalent to a three-dimensional torus and orbits are therefore also sometimes referred to as tori. The angles describe the time-dependent part of galactic motions and when considering ensembles of orbits believed to be in equilibrium, the angles can therefore not be important variables; action-angle coordinates thus naturally separate the ephemeral from the eternal in the study of galaxies. When considering orbits in galaxies, in which we believe many orbits to be regular and thus to conform to this picture, it is worth keeping this picture in mind. Action-angle coordinates are furthermore very important in the study of the stability of stellar systems and their response to perturbations.

## End-of-chapter questions

We computed the escape velocity near the Sun assuming that all of the mass of the Milky Way is spherically distributed and contained within the Sun's orbit at 8 kpc from the center. Derive a direct relation between the escape velocity and the circular velocity under this assumption. What is the correct relation?
$$v_\mathrm{esc} = 2\,v_c$$
$$v_\mathrm{esc} = v_c/\sqrt{2}$$
$$v_\mathrm{esc} = \sqrt{3}\,v_c$$
$$v_\mathrm{esc} = \sqrt{2}\,v_c$$