Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Classical mechanics - Time dependent Hamiltonian and Lagrangian

  1. Mar 14, 2010 #1
    1. The problem statement, all variables and given/known data

    A system with only one degree of freedom is described by the following Hamiltonian:

    [tex] H = \frac{p^2}{2A} + Bqpe^{-\alpha t} + \frac{AB}{2}q^2 e^{-\alpha t}(\alpha + Be^{-\alpha t}) + \frac{kq^2}{2} [/tex]

    with A, B, alpha and k constants.

    a) Find a Lagrangian corresponding to this Hamiltonian;
    b) Find an equivalent Lagrangian which is not explicitly time-dependent;
    c) What Hamiltonian corresponds to this second Lagrangian, and how is it related to the original Hamiltonian?

    2. Relevant equations

    Since this system has only one degree of freedom, the Hamiltonian is

    [tex] H = \dot{q}p - L [/tex]

    which implies that the Lagrangian is
    [tex] L = \dot{q}p - H [/tex]

    Also, canonical momentum p is defined as
    [tex] p_i \equiv \frac{\partial L(q_j,\dot{q_j},t)}{\partial \dot{q_i}} \\
    \Rightarrow p = \frac{\partial L}{\partial \dot{q}} [/tex]

    3. The attempt at a solution

    I've manipulated the Hamiltonian enough now that I'm pretty sure it corresponds to a damped harmonic oscillator with mass A. I also have a pretty good idea of what I should be doing, but I stumble at every step. We've just started working on the Hamiltonian formulation in class, so nothing is automatic yet. This is also the first time homework deals with a Lagrangian that is explicitly dependent on time.

    First step is obviously obtaining [tex]L(q,\dot{q},p,t)[/tex] by using the second Legendre transformation above, which is trivial. Next, I want to remove [tex]p[/tex] to obtain a proper [tex]L(q,\dot{q},t)[/tex]. This is where I hit the first obstacle. Using the definition of [tex]p_i[/tex] doesn't help here, because [tex]p = \frac{\partial L(q,\dot{q},p,t)}{\partial \dot{q}} = p[/tex]. So, I have no way to formally obtain [tex] p = p(q,\dot{q},t)[/tex] to obtain the real Lagrangian [tex]L(q,\dot{q},t)[/tex]. Nevertheless, intuition suggests [tex] p = \dot{q}[/tex], which would give the explicitly time-dependent Lagrangian

    [tex]L = \frac{p^2}{2A}\ + \ Bq\dot{q}e^{-\alpha t} \ - \ \frac{AB}{2}q^2 \alpha e^{-\alpha t} \ - \ \frac{A B^2}{2}q^2e^{-2\alpha t} \ - \ \frac{kq^2}{2} [/tex]

    From there on, I'm clueless as how to make the time-dependence disappear. I've tried completing the square of the 3rd and 4th terms, tried to link the 2nd and 3rd terms through a total time derivative, a combination of both these approaches, etc.. but nothing seems to be working correctly. (Except posing [tex]B = e^{\alpha t}[/tex] which is not allowed because B is a constant... but one can dream that homework should be that easy.:smile:)

    And obviously, since I can't get a time-independent Lagrangian, I can't use that to obtain a time-independent Hamiltonian and compare it to the original Hamiltonian.

    So to sum up, these are my questions:

    1) Knowing H, how do I find [tex] p = p(q,\dot{q},t)[/tex] to get a "clean" Lagrangian?
    2) Having found that time-dependent Lagrangian, how do I remove the explicit time dependency?

    Any hint would be greatly appreciated. Thank you very much.
  2. jcsd
  3. Mar 14, 2010 #2


    User Avatar
    Homework Helper
    Gold Member

    Intuition alone does not make a very convincing argument. Instead, try using one of Hamilton's equations of motion.:wink:
  4. Mar 14, 2010 #3
    Thank you for your answer, gabbagabbahey. It was very helpful.

    Indeed, intuition can often lead to error, as it did in my problem above. :smile:

    I've used Hamilton's equation as you suggested, and I've made some progress. Starting with the original Hamiltonian and using

    [tex]\dot{q} = \frac{\partial H}{\partial p} = \frac{p}{A} -Bqe^{-\alpha t}[/tex]

    I get

    [tex]p = A\dot{q} + ABqe^{-\alpha t} [/tex]

    which gives the Lagrangian (after some algebra)

    [tex] L = \frac{A\dot{q^2}}{2} + ABq\dot{q}e^{-\alpha t} - \frac{AB}{2}q^2\alpha e^{-\alpha t} - \frac{kq^2}{2}[/tex]
    [tex] = \frac{A\dot{q^2}}{2} + \frac{d}{dt}\left(\frac{AB}{2}q^2e^{-\alpha t} \right) - \frac{kq^2}{2}[/tex]

    I'm still stuck as to how to remove the explicit time dependency. I don't know if the last line is useful or not, but it makes it more explicit that we're dealing with a damped harmonic oscillator, which I guess will be useful for question c). The first time being kinetic energy, the last term being potential energy, and the middle term indicating that kinetic energy decreases exponentially with time. But so far, that doesn't help with question b).

    Any further hint would be greatly appreciated.

    By the way, I've just noticed that this is problem 8.16 in Goldstein's Classical Mechanics (3rd ed).
  5. Mar 14, 2010 #4


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    What do you know about a total time derivative in a Lagrangian?
  6. Mar 15, 2010 #5
    Err, ehm... I don't recall any property in particular. It does seem a bit peculiar (which is why I made it explicit), but I don't know what to do with it.
  7. Mar 15, 2010 #6


    User Avatar
    Homework Helper
    Gold Member

    Take a look at the action, the integral of the Lagrangian. Use the fundamental theorem of calculus on the term involving the total time derivative. You should see that minimizing the action of the Lagrangian [tex]\mathcal{L}=\overline{\mathcal{L}}+\frac{d}{dt}f(q,\dot{q},t)[/itex] is equivalent to minimizing the action of the Lagrangian [tex]\overline{\mathcal{L}}[/tex]
  8. Mar 15, 2010 #7
    That's a good hint. Obviously, integrating the (d/dt) term results in a constant which doesn't affect optimization.

    So, the time-independent Lagrangian is "equivalent" to the time-dependent Lagrangian minus the total time derivative part? That seems a bit strange to me, because inserting the two Lagrangians in the Euler-Lagrange would result in different equations of motion. Or am I taking the word equivalent too strongly here?
  9. Mar 15, 2010 #8


    User Avatar
    Homework Helper
    Gold Member

    Correct, both will produce the same optimization of the action integral, and hence both must lead to the exact same physics and both are valid Lagrangians for this system.

    Would it really? Try it out. You should find that even if you get different looking differential equations in the two cases, they will have the exact same solutions.
  10. Mar 15, 2010 #9
    I don't see where I'm wrong:
    [tex] \frac{d}{dt}\left(\frac{\partial L}{\partial \dot{q}} \right) - \frac{\partial L}{\partial q} = 0 [/tex]

    [tex] L_1 = \frac{A}{2}\dot{q}^2 + \frac{d}{dt} \left(\frac{AB}{2}q^2e^{-\alpha t}} \right) - \frac{kq^2}{2} [/tex]

    Using [tex]L_1[/tex], I get:
    [tex] A\ddot{q} - \frac{\partial}{\partial q}\left[ \frac{d}{dt}\left(\frac{AB}{2}q^2e^{-\alpha t} \right)+ \frac{kq^2}{2}\right] [/tex]

    [tex] = A\ddot{q} - ABe^{-\alpha t}(\dot{q} - \alpha q) + kq = 0 [/tex]

    While if I use
    [tex]L_2 = \frac{A}{2}\dot{q}^2 - \frac{kq^2}{2} [/tex]
    I get:

    [tex]A\ddot{q} + kq = 0[/tex]

    I've carefully respected the order of derivation in the middle term, hoping that derivation of the product would eventually yield canceling terms, but I'm stuck with [tex]\dot{q} - \alpha q[/tex]. The second equation is obviously a regular harmonic oscillator with solution x(t) = Ccos(wt + d), while Wolfram Alpha tells me that the solution to the first differential equation is something very ugly involving lots of complex exponents (even on the constants A, B and alpha) and something called the Kummer confluent hypergeometric function.

    I do understand that at this point I'm basically asking you to do the problem for me and I want to express my thanks for the help you guys have provided or will provide (you too, vela). Thanks.
  11. Mar 15, 2010 #10


    User Avatar
    Homework Helper
    Gold Member

    [tex]\frac{\partial L_1}{\partial \dot{q}}\neq A\dot{q}[/tex]

    The total time derivative term will also have a [itex]\dot{q}[/itex] in it after you carry out the time derivative (which you must do before taking your partial derivative w.r.t [itex]\dot{q}[/itex])
  12. Mar 15, 2010 #11
    Dang, and here I thought I was being all careful and I would get the final result right. Well, I've done it, and I wouldn't have without help from you guys. Thank you very much to both of you.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook