# Why use constraints at start in the Hamiltonian expression?

For example, consider the following situation:

I have a simple plane pendulum consisting of a mass $m$ attached to a string of length $\ell$. After the pendulum is set into motion, the length of the string is shortened at a constant rate

$$\tag{1}\frac{d\ell}{dt}=-\alpha=constant$$

as shown in the below image

then, if i want to write the Hamiltonian why can't i simply write its definition $${\cal H} = p_\theta \dot{\theta} + p_\ell \dot{\ell} - {\cal L}$$ and work on it and, in the end, apply (1) to my results?

I see in every example of hamiltonian always the "constraints" are applied directly in the start of the process (in the solution of this particular example, after apply (1) the hamiltonian is ${\cal H} = p_\theta \dot{\theta} - {\cal L}$). Why this happen?

• $\uparrow$ See where? – Qmechanic Oct 5 '17 at 9:17
• How do you intend to "apply (1) to [your] results"? If you do not impose the constraint from the start your results simply won't obey it. – ACuriousMind Oct 5 '17 at 10:22
• You can do this if you include the string force in your Lagrangian. If you don't include the force of the string SOMEWHERE, you know you won't get the correct answer. You can either explicitly write in some model of a string force (say, as a spring with large $k$), or apply a constraint from the beginning that gets rid of the string force. But you CAN'T get rid of the constraint and NOT include a string force. – Jahan Claes Oct 5 '17 at 21:36

TL;DR: OP is right: There are several equivalent ways to construct a Hamiltonian formulation, some apply the constraints at the beginning, some at a later stage.

Below let us illustrate how this plays out in OP's example:

1. We start with a system with Lagrangian $$L_1~:=~L_0 + \lambda \chi_1, \qquad L_0~:=T-V,$$ $$T ~:=~\frac{m}{2}(\dot{\ell}^2+\ell^2\dot{\theta}^2), \qquad V~:=~-mg\ell\cos\theta, \tag{A}$$ with Lagrange multiplier $\lambda$ and holonomic constraint $$\chi_1~:=~\ell-\ell_0+\alpha t~\approx~0. \tag{B}$$ Note that the constraint $\chi_1$ (and hence the Lagrangian $L_1$) carry explicit time dependence. The Lagrangian momenta read $$p_{\ell}~:=~\frac{\partial L_1}{\partial \dot{\ell}}~=~m\dot{\ell}, \qquad p_{\theta}~:=~\frac{\partial L_1}{\partial \dot{\theta}} ~=~m\ell^2\dot{\theta}.\tag{C}$$ Next perform the Dirac-Bergmann analysis. The bare Hamiltonian reads $$H_0~:=~\frac{p_{\ell}^2}{2m} + \frac{p_{\theta}^2}{2m\ell^2}. \tag{D}$$ Interesting, there is a secondary constraint $$0~\approx~\frac{d\chi_1}{dt}~\approx~\{\chi_1, H_0\} + \frac{\partial\chi_1}{\partial t}~=~\frac{p_{\ell}}{m}+\alpha .\tag{E}$$ In the end the corresponding Hamiltonian becomes $$H_1~=~\frac{p_{\ell}^2}{2m} + \frac{p_{\theta}^2}{2m\ell^2} +V -\lambda \chi_1-\lambda^{\prime} \left( \frac{p_{\ell}}{m}+\alpha\right) \tag{F}.$$ One may eliminate/integrate out the constraints in eq. (F).

2. Another possibility is to eliminate the constraint $\chi_1$ and the radial coordinate $\ell$ from the very beginning: $$L_2~:=~\frac{m}{2}(\ell_0-\alpha t)^2 \dot{\theta}^2+mg(\ell_0-\alpha t)\cos\theta, \tag{G}$$ and then perform the Legendre transformation.

3. A third possibility is to rewrite the holonomic constraint $\chi_1$ as a semiholonomic constraint $$\chi_3~:=~\dot{\ell}+\alpha~\approx~0. \tag{H}$$ Then the Lagrangian reads $$L_3~:=~L_0 + \lambda \chi_3.\tag{I}$$ The Lagrangian momenta read $$p_{\ell}~:=~\frac{\partial L_3}{\partial \dot{\ell}}~=~m\dot{\ell}+\lambda, \qquad p_{\theta}~:=~\frac{\partial L_3}{\partial \dot{\theta}}~=~m\ell^2\dot{\theta}. \tag{J}$$ In the end the corresponding Hamiltonian becomes $$H_3~=~\frac{(p_{\ell}-\lambda)^2}{2m} + \frac{p_{\theta}^2}{2m\ell^2} +V -\lambda \alpha \tag{K}.$$

4. Interestingly, the Lagrange multiplier $\lambda$ enters quadratically in eq. (K). It may be integrated out. The resulting Hamiltonian becomes (after discarding constant terms) $$H_4~=~ \frac{p_{\theta}^2}{2m\ell^2} +V -p_{\ell} \alpha .\tag{L}$$

All the above approaches lead to the same core system of EOMs: $$\dot{p}_{\theta}~\approx~-\frac{\partial V}{\partial \theta}, \qquad p_{\theta}~\approx~~m\ell^2\dot{\theta}, \qquad \dot{\ell}+\alpha~\approx~0.\tag{M}$$

You cannot simply write $${H} = p_\theta \dot{\theta} + p_l \dot{l} - { L},$$ because $l$ does not correspond to a degree of freedom of the system since this variable cannot change freely. You will not obtain $l(t)$ by minimizing the action, it is already fixed by the rheonomic constraint $dl/dt=-\alpha$. Put in another words, $l$ is not a coordinate of the phase space and there is no $p_l$.

What you are supposed to do is to write the lagrangian for the one-degree-of-freedom system, $$L=\frac{m}{2}(l^2\dot\theta^2+\alpha^2),$$ and then the Hamiltonian, $$H=p_\theta\dot\theta-L.$$