# Hamiltonian w.r.t. to Lagrangian [closed]

How can I express an arbitrary Hamiltonian w.r.t. to his Lagrangian.

Attempt:

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

with

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

and

$$\dot{p} = -\frac{\partial H}{\partial q}$$

So

$$\frac{d}{dt}\frac{\partial L}{\partial \dot{q}} =-\frac{\partial H}{\partial q}$$

We can derivate:

$$\frac{\partial}{\partial q}\left( \sum_k{\dot{q_k}\frac{\partial L}{\partial \dot{q_k}}} - L\right) =-\frac{d}{dt}\frac{\partial L}{\partial \dot{q}}$$

$$\frac{\partial}{\partial q}\left( \dot{q}\frac{\partial L}{\partial \dot{q}} - L\right)$$

$$\frac{\partial \dot{q}}{\partial q}\frac{\partial L}{\partial \dot{q}} + \dot{q}\frac{\partial L}{\partial q \partial \dot{q}}-\frac{\partial L}{\partial q}=-\frac{d}{dt}\frac{\partial L}{\partial \dot{q}}$$

So simply:

$$\dot{q}\frac{\partial L}{\partial q \partial \dot{q}}-\frac{\partial L}{\partial q}+\frac{d}{dt}\frac{\partial L}{\partial \dot{q}}= 0$$

It can be written as Euler Lagrange équation offseted.

$$\frac{d}{dt}\frac{\partial L}{\partial \dot{q}} - \frac{\partial L}{\partial q} + \dot{q}\frac{\partial L}{\partial q \partial \dot{q}} = 0$$

Is that mean $$\dot{q}\frac{\partial L}{\partial q \partial \dot{q}}$$ is necessary 0?

Is that formulation correct? Am I mistaken Somewhere?

• Question is worth answering. Commented Jan 1 at 19:01
• @naturallyInconsistent thanks for your relevant feedback. Commented Jan 1 at 19:14

I believe the problem arises because you are quite carelessly switching between two different sets of variables. The derivative $$\partial_q \mathcal L(q, \dot q)$$ is not the same as $$\partial_q \mathcal L(q, p_q)$$. In particular, in terms of variables $$(q,p_q)$$, $$\partial_q \dot q(q,p_q)$$ is not necessarily $$0$$.
You should repeat this calculation with attention to the coordinates in which you are performing each differentiation. A convenient notation trick borrowed from thermodynamics is to write all the independent variables in a subscript for each differentiation $$\left( \frac{\partial \mathcal L}{\partial q}\right)_{\dot q}$$ is the derivative performed in coordinates $$(q,\dot q)$$ i.e. the derivative of the function $$\mathcal L(q, \dot q)$$, while $$\left( \frac{\partial \mathcal L}{\partial q}\right)_{p_q}$$ is performed in the coordinates $$(q, p_q)$$, i.e. the derivative of the function $$\mathcal{L}(q,p_q)$$. To be clear, in the coordinates $$(q, p_q)$$, $$\dot q$$ is not independent - it becomes a function $$\dot q(q,p_q)$$ and the Lagrangian can be expressed via the composition $$\mathcal{L}(q,p_q) = \mathcal L(q,\dot q(q, p_q))$$.
• Yes, this is it. When one writes the Hamiltonian thus, $H=\sum p\dot q-L$, one is in fact doing a Legendre transformation like the ones in thermodynamics. Commented Jan 1 at 19:47