# The relation between Hamiltonian and Energy

I know Hamiltonian can be energy and be a constant of motion if and only if:

1. Lagrangian be time-independent,
2. potential be independent of velocity,
3. coordinate be time independent.

Otherwise $$H\neq E\neq {\rm const},$$ or $$H=E\neq {\rm const},$$ or $$H\neq E={\rm const}.$$

I am looking for examples of these three situation.

• "Hamiltonian" expressed via unknown variables $q$ and $p$ is a Hamiltonian and serves for writing down equations of motion. "Hamiltonian" expressed via solutions $q(t)$ and $p(t)$ is energy $E$. Energy is not obliged to be conserved. For example, a ball bouncing elastically from a still wall has a constant energy, but the same ball in a moving reference frame (where the wall hits the still ball) acquires energy due to collision. In the latter case the moving wall is described as a time-dependent potential $U(q,t)=V(q-vt)$ Mar 25 '13 at 15:37
• @VladimirKalitvianski Strange answer I believe. When energy is not conserved, would you still continue to talk about energy ? For instance, in QM, time dependent problems usually have no defined energy, am I wrong ? Mar 25 '13 at 15:41
• Related: physics.stackexchange.com/q/11905/2451 and links therein. Mar 25 '13 at 16:47
• @Oaoa: Yes, you are wrong. In QM any measured energy is an eigenvalue $E_n$ and a state without certain energy has these eigenstates in a superposition or mixture. Mar 25 '13 at 17:53
• @VladimirKalitvianski Ok that's just a terminology problem. I would not call this state having definite energy. But you're essentially right of course :-) Thanks. Mar 25 '13 at 20:52

Example. Time-dependent gravitational acceleration ($H=E$ but $\dot E \neq 0$)

Consider a particle falling under the influence of gravity near the surface of a large, spherically symmetric planet. Suppose that the mass of the planet changes with time, so that the acceleration due to gravity near the surface is some function $g(t)$ of time. Then the Lagrangian is $$L(t, z, \dot z) = \frac{1}{2}m\dot z^2 - mg(t)z$$ then the canonical momentum conjugate to $z$ is $$p_z = \frac{\partial L}{\partial\dot z} = m\dot z$$ and the Hamiltonian is $$H = p_z\dot z - L = \frac{p_z^2}{2m} +mg z$$ Notice that in this case $H(t) = E(t)$; the Hamiltonian is equal to the total energy. Now, in this case, the equations of motion are $$\dot p_z(t) = -mg(t)$$ So for any solution $z(t)$ to the equations of motion, we have $$\dot E(t) = p_z\dot p_z + m(\dot gz + g\dot z) = p_z(\dot p_z + mg) + m\dot g z = m\dot g z\neq 0$$ Total energy is not conserved, it changes as a function of time due to the fact that the gravitational acceleration depends on time.

• Conservation of energy is a consequence of time translation invariance. In situations where time translation invariance is broken, such as the example suggested by josh, Energy is not conserved. You must understand that fundamentally energy is always conserved, but in many situations one cannot look at all factors that contribute to energy.(in josh's example we are ignoring why the planet's mass is increasing). Energy and Hamiltonian are one and the same. In situations where there is no explicit time dependence on the Hamiltonian, energy is conserved. Mar 25 '13 at 17:28
• Joshphysics example is quite realistic if the gravitational force changes not because of varying mass $m(t)$, but because of moving planet: $g(t)=-G\cdot M/R^2 (t)$. Mar 25 '13 at 18:40
• maybe you missed $m$ so that $H=\frac{p_z^2}{2m} + mgz$? Mar 14 '18 at 1:48