# Hamiltonian is conserved, but is not the total mechanical energy

I wondering about the interpretation for the energy difference between the Hamiltonian and the total mechanical energy for systems where the Hamiltonian is conserved, but it is not equal to the total mechanical energy.

For example, consider a bead (mass $$m$$) on a frictionless hoop (radius $$R$$) in the presence of gravity. The hoop is spun around an axis parallel to the gravitational acceleration at constant angular speed ($$\omega$$). This is the typical set up for this problem.

The total energy for this system (using $$\phi$$ to denote the angle from the bottom of the hoop) is:

$$E = \frac{p_{\phi}^2}{2mR^2} + \frac{1}{2} mR^2 \omega^2 \sin^2 \phi + mgR (1- \cos \phi)\tag{1}$$

where

$$p_{\phi} = mR^2\dot{\phi}\tag{2}.$$

The Hamiltonian is:

$$H = \frac{p_{\phi}^2}{2mR^2} - \frac{1}{2} mR^2 \omega^2 \sin^2 \phi + mgR (1- \cos \phi).\tag{3}$$

So the difference between the total mechanical energy and the Hamiltonian is:

$$E-H = mR^2 \omega^2 \sin^2 \phi\tag{4}$$

which is twice the rotational kinetic energy, I think. I'm just trying to get a handle on what this difference means. Any help is appreciated.

I think this theorem might help to you.

Assume that $L=T-U$ is lagrangian of the system. $T$ is kinetic energy that presented as a quadratic form of $\dot{q}$: $T=\frac{1}{2}\sum a_{ij}\dot{q_i}\dot{q_j}$, $a_{ij}=a_{ji}(q,t)$; $U=U(q)$.

Theorem: Under these assumptions Hamiltonian $H$ is total energy of system $H=T+U$

Proof of theorem: Using Euler's theorem on homogeneous functions $\frac{\partial f}{\partial x}x=2f$. Then we have: $H=p\dot{q}-L=\frac{\partial L}{\partial \dot{q}}\dot{q}-(T-U)=2T-(T-U)=T+U$ $\blacksquare$

So if you have system with these assumptions you can say that Hamiltonian and the total energy are the same thing.

I know for sure that if the potential energy depends on the velocity, the energy will be different from Hamiltonian.

It is the external energy that the hoop needs to spin. The Hamiltonian is a conserved quantity since it does not depend on time explicitly, but the mechanical energy (kinetic plus potential) is not conserved.

Note that:

$$E=K_1 + K_2 + U$$ where $K_2$ is the kinetic term which does not depend on velocities $\dot \phi$, then $$L=K_1 + K_2 - U$$ and $$H=K_1 - K_2 + U$$ since $K_2$ does not depend on velocities and for the Hamiltonian it is an effective potential term.

I think it's due to the fact that your transformation equations between $x_{\alpha ,i}$ and $q_{j}$ do explicitly contain the time.

$$x = Rsin(\phi )cos(\theta )=Rsin(\phi )cos(\omega t)$$ $$y = Rsin(\phi )sin(\theta )=Rsin(\phi )sin(\omega t)$$ $$z = Rcos(\phi )$$

And, according to the theorem mentioned by Oiale, your kinetic energy does not present as a quadratic form of $\dot{q}$. That is why your Hamiltonian (canonical energy) is not equal to mechanical energy. The sufficient conditions of $H=E$ is :

(1) The potential energy is velocity independent.

(2) The transformation equations between $x_{\alpha ,i}$ and $q_{j}$ do not explicitly contain the time

Therefore, if we rewrite the coordinate transformation,

$$x = Rsin(\phi )cos(\theta )$$ $$y = Rsin(\phi )sin(\theta )$$ $$z = Rcos(\phi )$$

then, your mechanical energy, Lagrangian and Hamiltonian(canonical energy) will be:

$$E =\frac{P_{\phi }^{2}}{2mR^{2}}+\frac{P_{\theta }^{2}}{2mR^{2}sin(\phi )^{2}}+mgRcos(\phi )$$ $$L=\frac{P_{\phi }^{2}}{2mR^{2}}+\frac{P_{\theta }^{2}}{2mR^{2}sin(\phi )^{2}}-mgRcos(\phi )$$ $$H =\frac{P_{\phi }^{2}}{2mR^{2}}+\frac{P_{\theta }^{2}}{2mR^{2}sin(\phi )^{2}}+mgRcos(\phi )$$

Obviously, $H=E$.

Sorry, I think I made a mistake. I just ignored the constraint equation, $$f(\phi ,\theta ,t) = \theta -\omega t = 0$$ Hence, I should modify my Hamiltonian. $$H^{'}=H-\lambda f(\phi ,\theta ,t)$$

Please see the "Hamiltonian from a Lagrangian with constraints?" topic in SE.

I think the Hamiltonian is not necessarily the energy for the following reason: you can demonstrate that the Lagrangian may be deduced from the D'alembert principle which is linked to the concept of force, etc. but it may be also deduced from the Hamilton's principle which is a pure mathematical concept applied to physics (a certain quantity has to be an extremum when integrated over the true path). Therefore, you can find different forms of Lagrangians giving the same equations of motion (Lagrange's equations): either by buiding up a Lagrangian $L=T-U$, or by building up another Lagrangian furnishing the same equations. You might think the latter Lagrangian gives the right equations of motion but is actually wrong: the Hamilton's principle prevents you to affirm this.

Example drawn from a french textbook (C. Cohen Tannoudji):

Let's imagine two independent identical 1D harmonic oscillators with x and y coordinates.

From the D'Alembert principle, you have

$L=T-U=\frac{1}{2}m(\dot{x}^2+\dot{y}^2)-\frac{1}{2}m\omega_0^2(x^2+y^2)$,

and the equations of motions are

$\ddot{x}=-\omega_0^2x$

and

$\ddot{y}=-\omega_0^2y$.

If you use this other Lagrangian $L'=m\dot{x}\dot{y}-m\omega_0xy$, you exactly find the same equations. $L'$ could have been deduced from the Hamilton's principle.

If, then, you decide to write the Hamiltonian using the usual Legendre's transformation and the definition of momentum, you easily show that the Hamiltonians are also different.

In the often mentioned case where a moving frame is chosen to define the coordinates, it is normal that the energy be different from the case where the frame is at rest. I mean, you find the same result in Newton's mechanics: a particle of mass $m$ and velocity $v$ has an energy $E=\frac{1}{2}mv^2$ whereas in its proper frame, $E=0$. Up to me this answer for the Hamiltonian is somehow trivial.

OP's bead can be modelled in at least 2 ways using an initial frame:

1. As having 1 DOF $$\theta$$. This is OP's method. The Lagrangian is$$^1$$ \begin{align}L_1(\theta,\dot{\theta})~=~& \frac{1}{2}mR^2( \dot{\theta}^2+\omega^2\sin^2\theta) - V,\cr V~=~& - mgR\cos\theta,\end{align}\tag{1L} the Lagrangian energy function is \begin{align} h_1(\theta,\dot{\theta})~:=~&\dot{\theta}\frac{\partial L_1(\theta,\dot{\theta})}{\partial\dot{\theta}}- L_1(\theta,\dot{\theta}) \cr ~=~& \frac{1}{2}mR^2( \dot{\theta}^2\color{red}{-}\omega^2\sin^2\theta) + V,\end{align}\tag{1h} and the Hamiltonian is $$H_1(\theta,p_{\theta})~=~\frac{p_{\theta}^2}{2mR^2}\color{red}{-}\frac{1}{2}mR^2\omega^2\sin^2\theta + V.\tag{1H}$$ The Lagrangian $$L_1$$ has no explicit time dependence, so the Lagrangian energy function $$h_1$$ and Hamiltonian $$H_1$$ are conserved. The 2 latter functions $$h_1$$ and $$H_1$$ have the same value, but different from the total mechanical energy $$E$$ of the bead. As we shall see, the issue is that the bead is not an isolated system.

2. As having 2 DOF $$(\theta,\phi)$$ with 1 time-dependent holonomic constraint $$\phi-\omega t\approx 0$$. The Lagrangian is $$L_2~=~ \frac{1}{2}mR^2( \dot{\theta}^2+\dot{\phi}^2\sin^2\theta ) - V+\lambda(\phi-\omega t),\tag{2L}$$ the Lagrangian energy function is $$h_2~=~ \frac{1}{2}mR^2( \dot{\theta}^2\color{red}{+}\dot{\phi}^2\sin^2\theta ) + V-\lambda(\phi-\omega t),\tag{2h}$$ and the Hamiltonian is $$H_2~=~\frac{p_{\theta}^2}{2mR^2}\color{red}{+}\frac{p_{\phi}^2}{2mR^2\sin^2\theta} + V -\lambda(\phi-\omega t).\tag{2H}$$ The 3 functions $$L_2$$, $$h_2$$ and $$H_2$$ have explicit time dependence. The Lagrangian energy function $$h_2$$ and Hamiltonian $$H_2$$ are equal to the total energy $$E$$.

The Lagrange multiplier$$^2$$ $$\lambda~\approx~\dot{p}_{\phi}, \qquad p_{\phi}~=~mR^2\dot{\phi}\sin^2\theta,\tag{\lambda}$$ can be determined from the EOM. It has an interpretation as an external constraint generalized force $$Q_{\phi}=\lambda$$ acting on the bead. Its power is equal to the rate of total energy gain of the bead $$\frac{dh_2}{dt}~\approx~P~=~Q_{\phi}\dot{\phi}~=~\lambda\dot{\phi}~\approx~\frac{d(p_{\phi}\omega)}{dt}, \tag{P}$$ i.e. the hoop is doing work on the bead. In other words, the difference $$h_1~\approx~h_2-p_{\phi}\omega \tag{h}$$ between the LHS and RHS of eq. (P) is conserved. This explains OP's observation (4).

$$^1$$ The Lagrangian $$L_1$$ is the same in the hoop's rotating reference frame: the only difference is that the second kinetic term is reinterpreted as minus the centrifugal potential.

NB: In this answer we use the standard physics notation for spherical coordinates, i.e. $$\theta$$ is the polar angle and $$\phi$$ the azimuthal angle.

$$^2$$ The $$\approx$$ symbol means equality modulo EOMs & constraints.

$$\uparrow$$ Figure taken from Question 3.57 on Chegg.com.