# Hamiltonian for forced systems

I am trying to learn Hamiltonian mechanics. While many textbooks treat closed systems, I have a hard time finding references for forced systems.

For example, if I consider simple systems of masses ($m_i$ connected to $m_{i+1}$ with a spring) it is easy to write down the Hamiltonian. But I'm not so sure how to directly write down the Hamiltonian if say there is an external force that moves for example $m_1$.

Is there a good textbook that treats more general cases like this?

-

Let the isolated system (for simplicity let's deal only with one dimension) move according to the equation of motion $$m\ddot{x} = -\frac{\partial U}{\partial x}.$$ This situation is described by the Hamiltonian $H_0(x,p_x) = \frac{p_x^2}{2m}+U(x)$.
Now, if this system is under action of the time-dependent external force $F_{\text{ext}}(t)$, its equation of motion is
$$m\ddot{x} = -\frac{\partial U}{\partial x} + F_{\text{ext}}(t).$$ It is easy to see that this situation is described by the Hamiltonian $$H(t) = H_0 -xF_{\text{ext}}(t).$$
Elementary but noticeable! I will use your example in my lectures starting next Monday. Actually, it is possible to include your example in the class of Lagrangian with structure $L(t,q,\dot{q})= T-V(t,q)$ with $V=U(q)-\sum_iaq^kQ_k(t)$, and than passing to Hamiltonian formulation through the usual Legendre transformation. However it is a nice example in view of its physical meaning. –  Valter Moretti Feb 15 at 17:23
Of course, in the Lagrangian scheme this is possible as well. I think it would be good for the students to get the time-independent concept of potential energy $U(x)$ first (both in the Lagrangian and Hamiltonian scheme), and only then tell them about the way to include forcing by a time-dependent term $-xF_{\text{ext}}(t)$. –  Ján Lalinský Feb 15 at 20:23
Actually I finally prove an overall theorem where a generalized potential $U(t,q,\dot{q})$ is used ($\dot{q}$ appear linearly at most). It describes for instance inertial forces, but also the electromagnetic interaction. But I did not have a physically interesting example for the intermediate case $U(t,q)$, now I have! –  Valter Moretti Feb 15 at 21:41