# Hamilton's equation of motion with other momentum

I wrote here a problem couple days ago. I figured out what was the problem there, but now it made another problem. Sorry for similiar question.

I'm trying to draw phase portrait for my ODE and for my hamiltonian received from this equation. I expected them to be the same and I'm not sure if I'm correct. Everywhere I used $$m=1$$.

My ODE is: $$\ddot{x}(t) + \gamma \dot{x}^2(t) = 0$$

For this system, I constructed Lagrangian (I checked it with Euler-Lagrange equation and it's ok): $$L = \frac{1}{2} \dot{x}^2 e^{\gamma x}$$ Using this, I constructed my Hamiltonian: $$H = \dot{x}p - L = \frac{1}{2}\dot{x}^2e^{\gamma x}$$ Using lagrangian, I calculated momentum: $$p =\frac{\partial L}{\partial \dot{x}} = \dot{x}e^{\gamma x}$$ So, I modified my hamiltonian and got: $$H = \frac{1}{2} p^2e^{-\gamma x}$$ Using this, I calculated equations of motion: $$\dot{x}(t) = pe^{-\gamma x} \\ \dot{p}(t) = \frac{1}{2}p^2 \gamma e^{-\gamma x}$$ Having this, I used RK4 method to draw $$p(x)$$. But my portrait $$x'(x)$$ and $$p(x)$$ doesn't look the same. So, that concerns me. Is something wrong with 'my' new hamiltonian? Or maybe, the portraits won't look the same in case where $$p \neq \dot{x}$$?

• Comment: The Lagrangian should be $L = \frac{1}{2} \dot{x}^2 e^{2\gamma x}$ in order to reproduce OP's ODE. – Qmechanic Jul 30 at 18:35
• if you solve your differential equation with RK4, you can plot $\dot{x}$ over $x$ why you need the Hamiltonian? – Eli Jul 30 at 18:44
• @Eli, because my teacher want me to check this way if this hamiltonian is correct. – pepe Jul 30 at 18:47
• This should be your Hamiltonian ${\it H}=1/2\,{\frac { \left( p \right) ^{2}}{{ {\rm e}^{2\,{\it ga}\,x }}}}$ and ${\frac {d}{d\tau}}x \left( \tau \right) ={\frac {p \left( \tau \right) }{{{\rm e}^{2\,{\it ga}\,x \left( \tau \right) }}}}$ ${\frac {d}{d\tau}}p \left( \tau \right) ={\frac { \left( p \left( \tau \right) \right) ^{2}{\it ga}}{{{\rm e}^{2\,{\it ga}\,x \left( \tau \right) }}}}$ – Eli Jul 30 at 19:44
• @pepe Why should it look the same? $\dot x \neq p$, as you showed (though you should note Qmechanic's correction). – J. Murray Jul 30 at 21:16

Hint 1 :

You must correct your Lagrangian to $$L = \frac{1}{2} \dot{x}^2 e^{2\gamma x}\tag{1-01}$$ as in Qmechanic's comment.

Hint 2 :

$$p\boldsymbol{\ne}m\,\dot{x}\boldsymbol{=}m\,\upsilon\,, \quad (m=1) \tag{2-01}$$ $$p\boldsymbol{=}e^{2\gamma x}\dot{x}\boldsymbol{=}M(x)\,\upsilon\tag{2-02}$$ where $$M(x)\boldsymbol{=}e^{2\gamma x}\tag{2-03}$$ serves as a position dependent mass term.

Hint 3 :

Since the Lagrangian does not depend on time explicitly, make use of the Beltrami identity to find directly a constant of the motion and solve the Euler-Lagrange equation.

Edit A (after OP's comment)

OP making use of the Beltrami identity successfully find the so simple to solve ODE $$\begin{equation} \dot{x}e^{\gamma x}\boldsymbol{=}C \boldsymbol{\Longrightarrow} x\boldsymbol{=}\cdots \tag{E-01}\label{E-01} \end{equation}$$

• Ok, I corrected my Lagrangian: $$L(x, \dot{x}) = \frac{1}{2} \dot{x}^2e^{2 \gamma x}$$ where $$p = e^{2 \gamma x} \dot{x}$$ I know, it doesn't work, because firstly I draw $x'(x)$ from ODE and later $e^{2 \gamma x}\dot{x}(x)$. That's why, I substitude $\dot{x} = p e^{-2 \gamma x}$ to $$H = \dot{x} p - L = \frac{1}{2} p^2 e^{-2 \gamma x}$$ But, it's still give me wrong sollution when I calculated Hamilton's equations of motion. I thought, that this way I used this 2nd hint. About 3rd hint - I've never heard before about Beltrami identity. I used example in your link. – pepe Aug 3 at 11:52
• So, in my case: $$L - \dot{x} \frac{\partial L}{\partial \dot{x}} = C \\ \frac{1}{2} m \dot{x}^2 e^{2 \gamma x} - \dot{x}m \dot{x} e ^{2 \gamma x} = C \\ - \frac{1}{2} m \dot{x}^2 e ^ {2 \gamma x} = C$$ This way I found my constant of motion. Ans should I solve Euler-Lagrange equation substituding this constant? I substituted my Lagrangian $$L = \frac{1}{2} \dot{x}^2 e ^ {2\gamma x}$$ and then I got my ODE, so it's correct. But, to be honest I have no idea what this Beltrami identity tells me and how it can help... – pepe Aug 3 at 11:57
• @pepe : see my Edit A. I suspect that you confuse $x$ with $t$. What is $x'(x)$ and $p(x)$?? – Frobenius Aug 3 at 12:45
• I suspect, $-\frac{1}{2}m$ was included into $C$. So, I solved eq. (E-01) with the same initial conditions: $x(0)=x_0$ and $\dot{x}(t)=v_0$. I got $x(t)$ and differentiated it to get $\dot{x}(t)$. $$x(t) = x_0+ \frac{1}{\gamma} \ln|v_0(\gamma+1| \\ \dot{x}(t) = \frac{v_0}{\gamma v_0 t + 1}$$ So, my goal was to get hamiltonian fot system described with my ODE (eq. 1 in my post). I had to compare phase portrait got using my ODE (eq.1) and got from my Hamilton's equations of motion. I suspect, it will look the same because they describe the same system. – pepe Aug 3 at 16:24
• I used Python to draw phase portrait of this ODE. For this, I had to contruct two equations: $$\dot{x}=y \\ \dot{y}=−\gamma y^2$$ So, by $x'(x)$ I understand the result of equations I wrote above. Next, I wrote Lagrangian, used Legendre transformation to get my Hamiltonian and substitude there $\dot{x} = p e ^{-2 \gamma x}$, because my $p \neq m\dot{x}$. That's how I construct my Hamiltonian to final term: $$H = \frac{1}{2}p^2 e^{-2 \gamma x}$$ – pepe Aug 3 at 16:25