## Hamiltonian -> Lagrangian

Consider the time-dependent Hamiltonian

$$H(q,p;t) = \frac{p^2}{2m \sin^2{(\omega t})} - \omega pq \cot{(\omega t)} - \frac{m}{2} \omega^2 \sin^2{(\omega t)} q^2$$

with constant m and $$\omega$$.
Find a corresponding Lagrangian $$L = L(q,\dot{q};t)$$

Ok, I know that the Hamiltonian is given by

$$H(q,p;t) = \dot{q}p - L(q, \dot{q};t)$$

where

$$p = \frac{\partial L}{\partial \dot{q}}$$

Is it as easy as

$$L(q, \dot{q};t) =\dot{q}p - H(q,p;t)$$?

And how do I get rid of the p's?

 PhysOrg.com science news on PhysOrg.com >> 'Whodunnit' of Irish potato famine solved>> The mammoth's lament: Study shows how cosmic impact sparked devastating climate change>> Curiosity Mars rover drills second rock target
 Since $$p = \frac{\partial L}{\partial \dot{q}}$$ you can substitute $$p$$ in $$L(q, \dot{q};t) =\dot{q}p - H(q,p;t)$$ and solve the differential equation.
 Yeah, nice equation.. Any tip on how to solve it?

## Hamiltonian -> Lagrangian

I still need help... Anyone?

 Recognitions: Homework Help Science Advisor You have a Hamiltonian H which is a function of q and p: H(q,p). From the Hamilton equations of motion you have that $$\dot{q} = \frac{\partial H(q,p)}{\partial p}$$. Now think about this equation for a minute, it gives you a formula for $$\dot{q}$$ in terms of q and p. But if you rearrange the equation by solving for p, it gives you a formula for p in terms q and $$\dot{q}$$. This is what you want! To see why form the object the $$p\dot{q} - H(q,p)$$ which is almost but not quite the Lagrangian. To make this quantity into the true Lagrangian you should substitute your formula for p in terms of q and $$\dot{q}$$ into this expression. This is the important step because you know the Lagrangian is a function of q and $$\dot{q}$$, not q and p.
 Ok, then I get the Lagrangian $$L = m \sin^2{(\omega t)} \left[ \left( \dot{q} + \omega t \cot{(\omega t)} \right) \left( \frac{1}{2} \dot{q} + \omega cot{(\omega t)} (1 - \frac{1}{2}q) \right) + \frac{1}{2} \omega^2 q^2 \right]$$ Now my mission is to "obtain, by choosing a suitable new coordinate, an equivalent time-independent Lagrangian $$\tilde{L}$$". How is this supposed to be done?
 Recognitions: Gold Member Science Advisor Staff Emeritus I don't know if this can help you, but a Lagrangian L and L' are equivalent (generate the same dynamics) if they differ by a total derivative to time of a function of q and t only: $$L' = L + \frac{d F(q_i,t)}{dt}$$ I didn't check, but maybe you can get all the time depedence into that form...
 I don't think that's what I'm supposed to do here. Referring to "by choosing a new coordinate"...
 There are time-dependence in every term so that is not a possibility.. =/
 Recognitions: Homework Help Science Advisor Logarythmic, The first thing you should do is check your algebra. The Lagrangian you've displayed in post 6 contains a (1-q/2) which doesn't make sense because q has units. When you get the Lagrangian right the situation will look better.
 Ok, I forgot a q so my correct Lagrangian is $$L = m \sin^2{(\omega t)} \left[ \frac{\dot{q}^2}{2} + \omega q \dot{q} \cot{(\omega t)} + \frac{1}{2} \omega^2 q^2 (1 + \cot^2{(\omega t)} ) \right]$$ but there is still a time dependence in every term so writing it as $$L = \tilde{L} + \frac{dF(q,t)}{dt}$$ will be hard..? Or?
 Recognitions: Homework Help Science Advisor Ok, your Lagrangian looks good now. At this point I think there is a fairly straightforward guess you can make as to what your new coordinate should be. To make it even more clear, you might try completing the square for qdot. PS The L' = L + df/dt thing isn't really important for this problem.
 Completing the square?
 Completing the square $$\begin{array}{rl} \alpha x^2 + \beta x + \gamma &= \alpha\left[ x^2 + \frac{\beta}{\alpha} x + \frac{\gamma}{\alpha}\right] \\ &= \alpha\left[ (x + \frac{\beta}{2 \alpha})^2 + (\frac{\gamma}{\alpha}-\frac{\beta^2}{4 \alpha^2}) \right] \end{array}$$ It looks a lot neater if we take $\alpha=1$: $$x^2 + \beta x + \gamma = (x + \beta /2)^2 + (\gamma-\beta^2/4)$$