# Getting from the Lagrangian $L=\frac12((\cosh^2(\theta)+\sinh^2(\theta))\dot\theta^2+\sinh^2(\theta)\dot\phi^2) - g\cosh(\theta)$ to the Hamiltonian?

I have the following Lagrangian: $$L=\frac{1}{2}((\cosh^2(\theta)+\sinh^2(\theta))\dot{\theta}^2+\sinh^2(\theta)\dot{\phi}^2) - g\cosh(\theta)$$ I want to write the Hamiltonian.

Usually I used this solution for this kind of problems: I write the component of Legendre transformation. \begin{align} p_{\theta} &= \frac{\partial L}{\partial \dot{\theta}} = \cosh^2(\theta)+\sinh^2(\theta))\dot{\theta} \\ p_{\phi} &= \frac{\partial L}{\partial \dot{\phi}}= \sinh^2(\theta)\dot{\phi} \end{align} From where I get $\dot{\theta}$ and $\dot{\phi}$.

I know that: $$L=\frac{p^2}{2m}-U$$ and $$H=p_{\nu}\dot{q}^{\nu}-L=p_{\nu}\dot{q}^{\nu}-\frac{p^2}{2m}+U$$ In the specific case with $m=1$: $$H=p_{\nu}\dot{q}^{\nu}-L=\frac{p_{\theta}^2}{\cosh^2(\theta)+\sinh^2(\theta)}+\frac{p_{\phi}^2}{\sinh^2(\phi)}-\frac{1}{2}p_{\theta}^2--\frac{1}{2}p_{\phi}^2+g\cosh(\theta)$$ Unfortunately it is not the correct result but the right one is: $$H=p_{\nu}\dot{q}^{\nu}-L=\frac{1}{2}\left(\frac{p_{\theta}^2}{\cosh^2(\theta)+\sinh^2(\theta)}+\frac{p_{\phi}^2}{\sinh^2(\phi)} \right) + g\cosh(\theta)$$ I do not understand if the problem is the process or I made a mistake in the particular case. I would like to figure out how to solve these exercises correctly.

• Hint: It seems you are using a wrong expression $L=\frac{p^2}{2m}-U$ for the Lagrangian, which is not applicable here. – Qmechanic Aug 30 '17 at 9:34
• Thanks! This aspect interests me. When the formula is valid? Under what conditions? – Stefano Barone Aug 30 '17 at 9:53

I'll spell out more explicitly what Qmechanic is getting at in his comment: You've over-thought this problem. You already have the Lagrangian at the very top of the page, so don't try to re-invent the wheel with $L=\frac{p^2}{2m}-U$ (which, by the way, is technically incorrect anyway since $p$ should never be used in a Lagrangian - but I digress).

Instead, just plug the formulae you have at the top of the page for $L$, $p_{\theta}$, and $p_{\phi}$ into $H=p_{\nu}\dot{q}^{\nu}-L$ and you're golden. Just don't forget to change from $\dot{q}$ to $p$, but that's always part of the deal anyway. Actually doing the math at this point is fairly trivial, so I'll leave it for you.