# Euler-Lagrange and Conservation of the Hamiltonian giving two different Equations of Motion

Consider the following Lagrangian: $$L=mR\left[\frac{1}{2}R\left(\dot{\theta}^2+\omega^{2}\sin^{2}\theta\right)+g\cos\theta\right],$$ with an associated Hamiltonian $$H=mR\left[\frac{1}{2}R\left(\dot{\theta}^2-\omega^{2}\sin^{2}\theta\right)-g\cos \theta\right].$$

If I take the Euler-Lagrange Equation, along with the small angle approximation $$\sin\theta=\theta,\,\cos\theta=1,$$ I end up with the second order ODE: $$\ddot{\theta}=\left(\omega^2-\frac{g}{R}\right)\theta.$$ However, the conservation of the Hamiltonian (i.e., treating it as a constant), $$\frac{\partial L}{\partial\dot{\theta}}\dot{\theta}-L=H,$$ yields an entirely different differential equation with different solutions to the one generated by using the standard Euler-Lagrange equation: $$\frac{H}{m}=\frac{1}{2}R\omega^2\theta^2-\frac{1}{2}R\dot{\theta}^2+g.$$ This leads to an entirely different result. Why is this happening?

• The discrepancy (v2) seems caused by an inconsistent truncation of the small angle approximation. Commented Nov 2, 2022 at 16:34
• Minor semantic comment (v2): OP's function $H(\theta, \dot{ \theta})$ is strictly speaking the energy function, not the Hamiltonian (although they have the same value). Commented Nov 2, 2022 at 17:16
• @Qmechanic Can you explain what you mean "H is strictly speaking the total energy, not the Hamiltonian"? Given OP's starting point of a time-independent Lagrangian $L(\theta, \dot \theta)$, OP seems to just be turning the usual crank of: $H = pv-L$ where $p=\frac{\partial L}{\partial \dot \theta}$ and $v=\dot \theta$. And the resulting expression is conserved and equal to what OP denotes as $H$, the usual Hamiltonian.
– hft
Commented Nov 2, 2022 at 17:36
• @Qmechanic Do you mean the Hamiltonian should be expressed in terms of $p$ and $\theta$?
– hft
Commented Nov 2, 2022 at 17:39
• Your Hamiltonian is not correct ?
– Eli
Commented Nov 2, 2022 at 17:47

Take your last equation, for the conservation of energy, except without making the small angle approximation in the cosine term., $$\frac{H}{m}=\frac{1}{2}R\omega^{2}\theta^{2}-\frac{1}{2}R\dot{\theta}^2+g\cos\theta.$$ Differentiating this gives $$\frac{\dot{H}}{m}=0=R\omega^{2}\theta\dot\theta-R\dot{\theta}\ddot{\theta}-g(\sin\theta)\dot{\theta}.$$ If you now apply the small angle approximation to the sine term at the end, the equation reduces to $$0=R\dot{\theta}\left(\omega^{2}\theta-\ddot{\theta}-\frac{g}{R}\theta\right),$$ which is clearly equivalent to what you got from the Euler-Lagrange equation.

There is a moral to this, which is that sometimes it is not sufficient to approximate $$\cos\theta\approx1$$, even when $$\theta\ll 1$$. If you had used the next-order approximation $$\cos\theta\approx1-\frac{1}{2}\theta^{2}$$, the problem would have never arisen. The key point is that the potential $$mgR\cos\theta$$ only effects physical phenomena through its derivative. [In this case, the derivative is the torque $$N=-\partial(mgR\cos\theta)/\partial\theta$$, in the same way that a force is the linear derivative $$F=-\partial V/\partial x$$ of a potential.] So neglecting all $$\theta$$-dependence of $$mgR\cos\theta$$ is equivalent to dropping it from the theory entirely, since the derivative of a constant is zero.

Consider the following Lagrangian: $$L=mR\left[\frac{1}{2}R\left(\dot{\theta}^2+\omega^{2}\sin^{2}\theta\right)+g\cos\theta\right],$$ with an associated Hamiltonian $$H=mR\left[\frac{1}{2}R\left(\dot{\theta}^2-\omega^{2}\sin^{2}\theta\right)-g\cos \theta\right].$$

OK, this looks fine.

This leads to an entirely different result. Why is this happening?

The Lagrangian and Hamiltonian equations of motion lead to the same result, so the problem must be your approximation.

The Lagrangian equation of motion is: $$mR^2\ddot\theta = mR^2\omega^2\sin\cos - mRg\sin \tag{1}$$

The Hamiltonian equations of motion are: $$-mR^2\omega^2\sin\cos +mRg\sin = -\dot p\;,$$ where $$p = mR^2\dot\theta$$ and $$\frac{p}{mR^2} = \dot\theta\;,$$ which can be combined to give: $$mR^2\ddot\theta = mR^2\omega^2\sin\cos - mRg\sin\;,\tag{2}$$ which is the same as Eq. (1).

this is the non linearized Hamiltonian

$$H=\frac 12\,m{R}^{2}{\dot\varphi }^{2}-\frac 12\,m{R}^{2}{\omega}^{2} \left( \sin \left( \varphi \right) \right) ^{2}-m\,R\,g\cos \left( \varphi \right)$$ the equation of motion ( Hamiltonian is the energy )

$$\frac {dH}{dt}=\frac{\partial H}{\partial \dot\varphi}\,\ddot\varphi+ \frac{\partial H}{\partial \varphi}\,\dot\varphi=0\tag 1$$

solving for $$~\ddot\varphi~$$ and linearized

$$\ddot\varphi=\left(\omega^2-\frac gR\right)\,\varphi$$ which is correct

but if you first linearized the Hamiltonian and then applying equation (1) you obtain this equation of motion

$$\ddot\varphi=\omega^2\varphi$$

the linearized Hamiltonian

$$H=\frac 12\,m{R}^{2}{\dot\varphi }^{2}-\frac 12\,m{R}^{2}{\omega}^{2}{\varphi }^{2}-m R\,g$$