Introducing the Hamiltonian as a"thermodynamic"potential

A conceptually simple physical interpretation of a conserved Hamiltonian $\mathcal{H}$ for a mechanical system with a time-dependent constraint is given. For the case of a bead on a vertical hoop forced to rotate with constant angular velocity $\omega$, $\mathcal{H}$ is nothing but the total energy of the system plus the external actuator keeping $\omega$ fixed. In an analogy with thermodynamics, the Hamiltonian is introduced as a thermodynamic potential obtained from a Legendre transformation of the energy, in a very instructive way. The ideas can be made extensive to different problems with time-dependent constraints.


Introduction
When teaching the Lagrange formalism in undergraduate or graduate classical mechanics courses it is usual to deal with problems in which the mechanical energy E M is not conserved, but the Hamiltonian H is. While this last property is a consequence that the Lagrangian L does not depend explicitly on time, the time dependent energy is due to the presence of non-conservative forces. In these situations, it is usual to hear the same question from students: so, if H is constant, what is it? what is its physical meaning? There is no general answer to these questions. Nonetheless, we give below an example of a standard non-conservative problem where H has a straightforward physical interpretation. We show as well that H can be obtained from a Legendre transformation of E M (besides its usual definition as a Legendre transformation of L) resulting in a simple and interesting parallelism between H and a thermodynamic potential. This perspective can be useful to help students understand the physics behind the Hamiltonian.

A bead on a rotating hoop
Let us consider the very well known mechanical setup depicted in Fig. 1: a bead of mass m on a rotating massless hoop of radius a that is externally constrained to move with constant angular velocity ω around the verticalẑ axis. Due to this constraint, this is a problem with just one degree of freedom. The best choice of a generalized coordinate in order to write down L is the angular variable θ as shown in Fig. 1. The problem is treated in many textbooks [1,2,3] as an example of time-dependent constraints (i.e., φ = ωt).
Due to the gravitational force acting on m, there is a critical frequency ω c = g/a below which the only stable equilibrium occurs at θ = 0. For ω > ω c , the stable equilibrium θ o is given by cos θ o = g/aω 2 , with θ o continuously moving from 0 to π/2 as ω increases. Much has been said and written about the many different aspects of this problem and slight variations of it [4]. However, we are not interested here in the detailed solution nor in the dynamics of the system. Instead we are going to focus on more general matters, mainly associated with the conserved quantities.
The Lagrangian L = T − U of this 1-degree of freedom system is The mechanical energy E M = T + U is not a conserved quantity (i.e., dE M /dt = 0) since an external actuator is doing work on the system to keep ω fixed. The system is non-conservative not in the sense that there are dissipative forces, but in the sense that there are forces doing work that have not been derived from a conservative potential energy. In this case, the external force acting to keep ω fixed. The Hamiltonian, on the other hand, calculated from its definition as the Legendre is conserved. ‡ Since it is conserved, does it have any physical interpretation? Let us see.
The external constraint torque that keeps ω constant is collinear with the vertical rotation axis of the hoop (ẑ axis). Any other torque component is canceled by the constraint that the hoop only rotates around the vertical axis. We can calculate this torque from its dynamical effects as N z = dLz dt . The angular momentum is given by L z = I z ω where I z = ma 2 sin 2 θ is the moment of inertia around theẑ axis. The work done by the torque is To be precise, H should be written explicitly in terms of its natural independent variables, θ and its conjugated momentum p θ = ∂L ∂θ . But we are not interested in these "minor" details here.
since ω is constant. § This work is done by the external actuator. Thus, the energy change in the actuator after doing this work is E a = −W . The total energy of the bead-hoop system plus the external actuator is then So, we arrive at the very interesting result that the conserved Hamiltonian is nothing but the total energy of the original system plus the actuator, that is, of the system and its surroundings, which obviously must be a conserved quantity, unless dissipative forces were acting (which are not).
The mechanical energy E M is not conserved because in the Lagrange formalism the work done by the constraint forces is not included. When these forces are associated with time-independent constraints, they do not do work. So, not including them has no effect and E M is conserved unless dissipative forces are acting. But when the constraint forces are linked to time-dependent constraints (as in our case), they indeed do work and because this work is not included in E M , it cannot conserve [5].

Hamiltonian and thermodynamic potentials
We are going to make use of the fact that H is a conserved energy to go a step forward and make an interesting analogy between H and the thermodynamic potentials. If the constraintφ = ω is relaxed, the system bead + hoop has now two degrees of freedom. Choosing θ and φ as generalized coordinates (see Fig. 1), the Lagrangian is written as L(θ,φ,θ) = 1 2 ma 2 (θ 2 +φ 2 sin 2 θ) + mga cos θ.
The energy is conserved now since the actuator is not working. On the other hand, φ is a cyclic coordinate. Hence, its conjugate momentum is also conserved. This momentum is just theẑ-component of the angular momentum, L z = mφa 2 sin 2 θ. The energy is given by where the first term and the last two terms to the right correspond to the kinetic energy and the potential energy of the effective one dimensional reduced problem, respectively. Since E M is conserved, Eqn. 6 is the "correct potential" and, from its minimization (i.e., ∂E M ∂θ Lz = 0), one can obtain the equilibrium states of the bead. § The lower limit of the integral in L z has been arbitrarily set to 0. Any other value would just only change the arbitrary energy zero, which has no physical significance.
The equilibrium state of a thermodynamic system is ruled by the second law. If, for simplicity, we consider a simple system whose equation of state can be described by just the volume, temperature and pressure, the 2 nd law states that in equilibrium the internal energy U of such a system is a minimum if the entropy and the volume are kept constant. This formulation of the 2 nd law is sometimes referred as the Energy Minimum Principle (EMP) [6] and is very useful for our purposes.
In the real world it is hard to find any process occurring at constant values of extensive parameters like the entropy or volume. Instead, most processes occur at a constant value of an intensive parameter, for instance, the pressure P . The concept of a reservoir is useful in these cases [6]. For instance, a P -reservoir is a system so large that any volume change affecting it can be considered negligible in such a way that the pressure inside it is always constant. If it is put in contact with other system, it also fixes the pressure of this system. A P -reservoir only exchanges energy in the form of mechanical work P dV .
So, let us put our simple thermodynamic system in contact with a P -reservoir. The equilibrium state can no longer be obtained from the minimization of U since V is not constant. In order to apply correctly the EMP we need to consider the whole "isolated" arrangement: system + P -reservoir, whose total volume (and entropy) is constant. Sometimes, this can be a difficult task. But the magnificence of the thermodynamics comes to our help and establishes that the equilibrium state is achieved from the potential obtained from a Legendre transformation of U with respect to V (conjugate variable associated with P ). In other words, minimizing U T = U + U R is absolutely equivalent to minimize where the potential H(S, P ) is nothing but the enthalpy of the system. Thus, when the system is in contact with a P -reservoir, H is the correct potential to obtain the equilibrium state, not U. Obviously, it is straightforward to show that H(S, P ) = U T . Let us go back to our mechanical bead+hoop system and make an analogy. If you put it in contact with a ω-reservoir (i.e., a very powerful external actuator that keeps ω constant regardless what the bead does), the equilibrium state can no longer be obtained from the minimization of E M since L z is no longer conserved. We need to consider, in turn, the whole "isolated" arrangement: system + ω-reservoir, whose total L z is constant. We have already seen that E M + E a is just H. Anyway, let us follow the protocol and calculate the Legendre transformation of E M with respect to L z E M ((θ,θ, L z )) − ∂E M ∂L z L z = E M ((θ,θ, L z )) − ωL z = 1 2 ma 2 (θ 2 − ω 2 sin 2 θ) − mga cos θ = H(θ,θ, ω) So, H is the correct "potential" to analize the equilibrium state when the system is in contact with a ω-reservoir.

Conclusions
Making use of a simple mechanical problem, i.e. a massive bead on a massless rotating hoop at constant ω, we analyze the physics behind the conserved Hamiltonian. We show that it corresponds to the total energy of the bead-hoop system plus the external actuator that keeps ω fixed. We also present an interesting and instructive analogy between the Hamiltonian and the thermodynamic potentials that can help students to understand its physical meaning.

Acknowledgments
The author thanks J. J. Guimpel and G. Abramson for a careful and critic reading of the manuscript. V. F. C is member of CONICET, Argentina.