# Classical mechanics - Time dependent Hamiltonian and Lagrangian

## Homework Statement

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

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

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?

## Homework Equations

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

$$H = \dot{q}p - L$$

which implies that the Lagrangian is
$$L = \dot{q}p - H$$

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

## 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 $$L(q,\dot{q},p,t)$$ by using the second Legendre transformation above, which is trivial. Next, I want to remove $$p$$ to obtain a proper $$L(q,\dot{q},t)$$. This is where I hit the first obstacle. Using the definition of $$p_i$$ doesn't help here, because $$p = \frac{\partial L(q,\dot{q},p,t)}{\partial \dot{q}} = p$$. So, I have no way to formally obtain $$p = p(q,\dot{q},t)$$ to obtain the real Lagrangian $$L(q,\dot{q},t)$$. Nevertheless, intuition suggests $$p = \dot{q}$$, which would give the explicitly time-dependent Lagrangian

$$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}$$

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 $$B = e^{\alpha t}$$ which is not allowed because B is a constant... but one can dream that homework should be that easy.)

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 $$p = p(q,\dot{q},t)$$ 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.

gabbagabbahey
Homework Helper
Gold Member
So, I have no way to formally obtain $$p = p(q,\dot{q},t)$$ to obtain the real Lagrangian $$L(q,\dot{q},t)$$. Nevertheless, intuition suggests $$p = \dot{q}$$

Intuition alone does not make a very convincing argument. Instead, try using one of Hamilton's equations of motion.

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

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

$$\dot{q} = \frac{\partial H}{\partial p} = \frac{p}{A} -Bqe^{-\alpha t}$$

I get

$$p = A\dot{q} + ABqe^{-\alpha t}$$

which gives the Lagrangian (after some algebra)

$$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}$$
$$= \frac{A\dot{q^2}}{2} + \frac{d}{dt}\left(\frac{AB}{2}q^2e^{-\alpha t} \right) - \frac{kq^2}{2}$$

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).

vela
Staff Emeritus
Homework Helper
What do you know about a total time derivative in a Lagrangian?

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.

gabbagabbahey
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 $$\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}}$$

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?

gabbagabbahey
Homework Helper
Gold Member
So, the time-independent Lagrangian is "equivalent" to the time-dependent Lagrangian minus the total time derivative part?

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.

That seems a bit strange to me, because inserting the two Lagrangians in the Euler-Lagrange would result in different equations of motion.

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.

I don't see where I'm wrong:
$$\frac{d}{dt}\left(\frac{\partial L}{\partial \dot{q}} \right) - \frac{\partial L}{\partial q} = 0$$

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

Using $$L_1$$, I get:
$$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]$$

$$= A\ddot{q} - ABe^{-\alpha t}(\dot{q} - \alpha q) + kq = 0$$

While if I use
$$L_2 = \frac{A}{2}\dot{q}^2 - \frac{kq^2}{2}$$
I get:

$$A\ddot{q} + kq = 0$$

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 $$\dot{q} - \alpha q$$. 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.

gabbagabbahey
Homework Helper
Gold Member
$$\frac{\partial L_1}{\partial \dot{q}}\neq A\dot{q}$$

The total time derivative term will also have a $\dot{q}$ in it after you carry out the time derivative (which you must do before taking your partial derivative w.r.t $\dot{q}$)

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.