The Hamiltonian Formalism

In the Lagrangian formalism the equations of motion are given by

\[ \begin{align}\begin{aligned} \tag{\ref{eq:21}} \dv{t}\qty(\pdv{L}{\dot{q}_i}) - \pdv{L}{q_i} = 0\\These are second-order differential equations, and so :math:`2n`\end{aligned}\end{align} \]

initial values are required for a full solution, with an \(n\)-dimensional configuration space. The Hamiltonian approach is to recast the equations of motion as first-order equations, with a configuration space of \(2n\) independent variables, describing the position of a point is spacetime, and the conjugate momenta. Now \((p, q)\) are the canonical variables.

The Legendre Transform

In order to switch from the parameters of the Lagrangian formalism, \((q, \dot{q}, t)\) to those of the Hamiltonian, \((q, p, t)\) we introduce a transformation.

Consider a function of the form

\[\dd{f} = u \dd{x} + v \dd{y}, \qquad u= \pdv{f}{x}, \quad v=\pdv{f}{y}\]

We want to change from using \(x\) and \(y\) in the description to using \(u\) and \(y\), so let

\[ \begin{align}\begin{aligned}g = f - ux\\which has a differential,\end{aligned}\end{align} \]
\[ \begin{align}\begin{aligned}\dd{g} = \dd{f} - u \dd{x} - x \dd{u} = v \dd{y} - x \dd{u}\\Thus :math:`x` and :math:`v` are now functions of :math:`u` and\end{aligned}\end{align} \]

\(y\):

\[x = - \pdv{g}{u}, \qquad v = \pdv{g}{y}\]

[Legendre transforms in thermodynamics] Consider the first law of thermodynamics,

\[\dd{U}= \dd{Q} - \dd{W}\]

For a gas undergoing a reversible process this can be re-expressed as

\[ \begin{align}\begin{aligned}\dd{U} = T \dd{S} - P \dd{V}\\For the entropy, :math:`S`, and volume :math:`V`. The temperature and\end{aligned}\end{align} \]

the pressure are given

\[ \begin{align}\begin{aligned}T = \pdv{U}{S} \qquad P = - \pdv{U}{V}\\To find the enthalpy, :math:`H(S,P)` we use a Legendre transform,\end{aligned}\end{align} \]
\[ \begin{align}\begin{aligned}H = U + PV\\which gives\end{aligned}\end{align} \]
\[ \begin{align}\begin{aligned}\dd{H} = T \dd{S} + V \dd{P}\\where\end{aligned}\end{align} \]
\[T = \pdv{H}{S}\ \qquad V = \pdv{H}{P}\]

The Hamiltonian

The Hamiltonian function is generated from the Lagrangian using a Legendre transform, starting with the differential of \(L\),

\[ \begin{align}\begin{aligned} \label{eq:83} \dd{L} = \pdv{L}{q_i} \dd{q_i} + \pdv{L}{\dot{q}_i} \dd{\dot{q}_i} + \pdv{L}{t} \dd{t}\\Recalling that :math:`p_i = \pdv*{L}{q_i}`, then\end{aligned}\end{align} \]
\[ \begin{align}\begin{aligned} \label{eq:84} \dd{L} = \dot{p}_i \dd{q}_i + p_i \dd{\dot{q}}_i + \pdv{L}{t} \dd{t}\\and we can transform to the Hamiltonian using\end{aligned}\end{align} \]
\[\label{eq:85} H(q, p, t) = \dot{q}_i p_i - L(q, \dot{q}, t)\]

with differential

\[ \begin{align}\begin{aligned} \label{eq:86} \dd{H}= \dot{q}_i \dd{p_i} - \dot{p}_i \dd{q}_i - \pdv{L}{t}\\and so\end{aligned}\end{align} \]
\[\label{eq:88} \dd{H} - \pdv{H}{q_i} \dd{q_i} + \pdv{H}{p_i} + \pdv{H}{t} \dd{t}\]

Thus we have \(2n +1\) relations,

\[\begin{split}\begin{aligned} \label{eq:89} \dot{q}_i & = \pdv{H}{p_i} \\ \label{eq:90} - \dot{p}_i & = \pdv{H}{q_i} \\ \label{eq:91} - \pdv{L}{t} & = \pdv{H}{t} \end{aligned}\end{split}\]

with equations ([eq:89] – [eq:90]) the canonical equations of Hamilton, which are the \(2n\) first-order equations which replace the \(n\) second-order Lagrange equations.

If the forces involved in the Lagrangian are the result of a conservative potential, and if the equations with generalised coordinates don’t depend explicitly on time then the Hamiltonian is equal to the total energy.

From the definition of \(H\) in equation ([eq:85]), and in the manner of equation ([eq:94]),

\[ \begin{align}\begin{aligned} \label{eq:98} H = \dot{q}_i p_i - [L_0(q_i, t) + L_1(q_i, t)\dot{q}_k + L_2(q_i, t) \dot{q}_k \dot{q}_m]\\If the equations defining the generalised coordinates do not explicitly\end{aligned}\end{align} \]

depend on time, \(L_2 \dot{q}_k \dot{q}_m = T\), and if the forces can be derived from a conservative potential, \(L_0 = -V\), and thus

\[\label{eq:99} H = T + V = E\]

Constructing the Hamiltonian

The procedure for constructing the Hamiltonian is

  1. Construct \(L\) in a given set of \(q_i\),

  2. Define the \(p_i\)

  3. Form the Hamiltonian using equation ([eq:85])

  4. Invert the conjugate momenta to gain the \(\dot{q}_i\)s

  5. These are used to eliminate all \(\dot{q}_i\) from \(H\)