# Help using Hamiltonian mechanics [closed]

I didn´t understand how to use Hamiltonian for some mechanical problems, in particular in a two-body $(m_1, m_2)$ attached by a string $(k,l). First, calculating The lagrangian: $$L=T-U=\dfrac{1}{2}m_1 \dot x_1^2+\dfrac{1}{2}m_2 \dot x_2^2-\dfrac{1}{2}k(x_2-x_1-l)^2$$ Then: $$p_1=\dfrac{\partial L}{\partial \dot x_1}=m_1 \dot x_1\implies\dot x_1=\dfrac{p_1}{m_1}$$ $$p_2=\dfrac{\partial L}{\partial \dot x_2}=m_2 \dot x_2\implies\dot x_2=\dfrac{p_2}{m_2}$$ $$\implies L=\dfrac{p_1}{2m_1}+\dfrac{p_2}{2m_2}-\dfrac{1}{2}k(\Delta x)^2$$ $$\Delta x=x_2-x_1-l$$ But i didn´t understand the relation with hamilton. ## closed as unclear what you're asking by ACuriousMind♦, Daniel Griscom, John Rennie, Kyle Kanos, MartinJan 8 '16 at 12:10 Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question. • What do you mean that you don't "understand the relation with hamilton?" Well where's your Hamiltonian? You've started your Legendre transform, but you've not completed it. – Kyle Kanos Jan 8 '16 at 11:27 ## 1 Answer There are two mistakes: • You stil have to have$x_1$,$x_2$otherwise the conjugate momenta$p_1$,$p_2$does not make any sense (they are conjugate momenta - they must be connected to some$x\$).

• You haven't done the full transformation. You just have a lagrangian in weird variables, but that is just half the work. See the wikipedia article.

I will not provide the full detailed answer since this is homework and excercises question.