# Energy in hamiltonian formalism from phase space evolution

The hamiltonian for a free falling body is $$H = \dfrac{p^2}{2m} + mgy$$ and since we are using cartesian coordinates that do not depend on time and the potential only depends on the position, we know that $$H=E$$. For this hamiltonian, using the Hamilton's equations and initial conditions $$y(0)=0$$ and $$p(0)=0$$, we get the evolution in the phase space: $$y(t) = -\dfrac{1}{2}gt^2\quad p(t)=-mgt$$

Now, imagine the opposite problem: we don't know anything about the system and the potentials involved, but someone gives us the phase space evolution, $$x(t)$$ and $$p(t)$$, for the same initial conditions. Can we get the energy using the hamiltonian formalism?.

From the phase space evolution, we know that $$\dot{y}=-gt = p/m$$ and $$\dot{p} = -mg$$. Then $$\dot{y}=\dfrac{\partial H}{\partial p} \ \Rightarrow\ H = \dfrac{p^2}{2m} + f(y,t)$$ $$\dot{p} = -\dfrac{\partial H}{\partial y} = -\dfrac{\partial f}{\partial y} \ \Rightarrow\ f(y,t) = mgy + g(t)$$ Concluding that $$H = \dfrac{p^2}{2m} + mgy + g(t)$$

Apparently, we don't have enough information to determine the form of $$g(t)$$. Two questions came to my mind:

1. Were the Hamilton's equations integrated correctly? This seems to work when I put $$\dot{y}$$ as a function of $$p$$, but woud it work expressing $$\dot{y}$$ in terms of other combinations of $$y$$, $$p$$ or $$t$$?. When is it mathematically correct to get rid of the time variable to integrate the equations?
2. How can we know the expression for $$g(t)$$, and how can we know the relation of the found hamiltonian with the energy if we don't have any explicit information about the potentials?.

Extra example

If I don't get rid of the time at the beginning, then $$\dot{y} = \dfrac{\partial H}{\partial p} = -gt \ \Rightarrow\ H = -gtp + f(y,t) \ \Rightarrow\ H = \dfrac{p^2}{m} + f(y,t)$$ We have lost the $$1/2$$ factor, and the equations of motions derivated from this hamiltonian won't be the same.

What is mathematically incorrect there?

• Lagrange function is determined up to a complete full derivative. Such gauge invariance is not surprising, since we are dealing with a purely mathematical object. If it results in the same equations of motion, i.e. the same predictions for observables, then there is no problem. Oct 28, 2020 at 10:19
• And how can we use it to determine the value of the energy and its time dependence? Oct 28, 2020 at 10:24
• You have to define what you call energy: a quantity measurable in experiment or a theoretical quantity, such as the value of the Hamiltonian. Oct 28, 2020 at 10:32
• Well your eom is clearly invariant under translation of time, thus your hamiltonian must be as well, so you cant have that time dependent term. You can only have a constant but that does not matter, energy is not absplute so a constant addition wont change Oct 28, 2020 at 10:43
• To add detail to physshyp's comment. $H_new = H_old + C$ (for C a constant) makes no difference to anything. It just adds an extra rate of change to the Global Phase, and the global phase is meaningless and thus so are changes to it over time. With C(t) (C varying in time) you are changing the rate of change of the global phase in a non-constant manner.
– Dast
Oct 28, 2020 at 10:50

So we are given the following information about the system : $$y(t)=-\frac{1}{2}gt^2$$ and $$p(t)=-mgt$$ with initial condition $$y(0)=0$$ and $$p(0)=0$$. You want to know the energy of the system. That's too is the information if you are asking for energy that means the system must conservative so that energy is conserved, and thus Hamiltonian should not depend on time.

But let's suppose we want to know the Hamiltonian ($$H=H(q,p,t)$$) of the system given such information, The Hamilton's equation given by

$$\frac{\partial H}{\partial q}=-\dot{p}, \ \ \ \ \ \frac{\partial H}{\partial p}=\dot{q}, \ \ \ \ \ \frac{\partial H}{\partial t}=-\frac{\partial L}{\partial t}$$

Now if it's not given that whether or not the system is conservative, we don't know about the last term. So as long as you don't know the third term you can not construct Hamiltonian uniquely.

Now write a way to do construct Hamiltonian is through its total derivative of Hamiltonian

$$dH=\frac{\partial H}{\partial p}dp+\frac{\partial H}{\partial q}dq$$

Now put values of these partial derivatives $$dH=mgdq+\frac{p}{m}dp$$

$$H=\frac{p^2}{2m}+mgq$$

Note: Again I'm writing this phase trajectory is useful for time-independent but if the game of rules is changing then it's not as great.

Extra Example

$$\frac{\partial H}{\partial p}=-gt$$
you can not integrate here with respect to $$p$$ as $$p$$ is changing with time or vice verse.