Skip to main content
Physics LibreTexts

14.4: Hamiltonian Mechanics Examples

I’ll do two examples by hamiltonian methods – the simple harmonic oscillator and the soap slithering in a conical basin. Both are conservative systems, and we can write the hamiltonian as \( T+V\), but we need to remember that we are regarding the hamiltonian as a function of the generalized coordinates and momenta. Thus we shall generally write translational kinetic energy as \( \frac{p^{2}}{(2m)}\) rather than as \( \frac{1}{2}m\nu^{2}\), and rotational kinetic energy as \( \frac{L^{2}}{(2I)}\) rather than as \( \frac{1}{2}I\omega^{2}\)

Simple harmonic oscillator

The potential energy is \( \frac{1}{2}kx^{2}\), so the hamiltonian is

\[ H=\frac{p^{2}}{2m}+\frac{1}{2}kx^{2}.\]

From equation D, we find that \( \dot{x}=\frac{p}{m}\), from which, by differentiation with respect to the time, \( \dot{p}=m\ddot{x}\). And from equation C, we find that \( \dot{p}=-kx\). Hence we obtain the equation of motion \( m\ddot{x}=-kx\).

Conical basin

We refer to Section 13.6:

\[ T=\frac{1}{2}m(\dot{r}^{2}+r^{2}\sin^{2}\alpha\dot{\phi}^{2})\]

\[ V=mgr\cos\alpha\]

\[ L=\frac{1}{2}m(\dot{r}^{2}+r^{2}\sin^{2}\alpha\dot{\phi}^{2})-mgr\cos\alpha\]

\[ L=\frac{1}{2}m(\dot{r}^{2}+r^{2}\sin^{2}\alpha\dot{\phi}^{2})+mgr\cos\alpha\]

But, in the hamiltonian formulation, we have to write the hamiltonian in terms of the generalized momenta, and we need to know what they are. We can get them from the lagrangian and equation A applied to each coordinate in turn. Thus

\[ P_{r}=\frac{\partial L}{\partial \dot{r}}=m\dot{r} \label{14.4.1}\]


\[ P_{\phi}=\frac{\partial L}{\partial \dot{\phi}}=mr^{2}\sin^{2}\alpha\dot{\phi}. \label{14.4.2}\]

Thus the hamiltonian is

\[ H=\frac{P_{r}^{2}}{2m}+\frac{p_{\phi}^{2}}{2mr^{2}\sin^{2}\alpha}+mgr\cos\alpha. \label{14.4.3}\]

Now we can obtain the equations of motion by applying equation D in turn to \( r\) and \( \phi\) and then equation C in turn to \( r\) and \( \phi\):

\[ \dot{r}=\frac{\partial H}{\partial p_{r}}=\frac{p_{r}}{m}, \label{14.4.4}\]

\[ \dot{\phi}=\frac{\partial H}{\partial p_{\phi}}=\frac{p_{\phi}}{mr^{2}\sin^{2}\alpha}, \label{14.4.5}\]

\[ \dot{p}_{r}=-\frac{\partial H}{\partial r}=\frac{p_{\phi}^{2}}{mr^{3}\sin^{2}\alpha}-mg\cos\alpha, \label{14.4.6}\]

\[ \dot{p_{\phi}}=\frac{\partial H}{\partial\phi}=0. \label{14.4.7}\]

Equations \( \ref{14.4.2}\) and \( \ref{14.4.7}\) tell us that \( mr^{2}\sin^{2}\alpha\dot{\phi}\) is constant and therefore that

\[ r^{2}\dot{\phi} \quad is \quad constant, =h,\quad say. \label{14.4.8}\]

This is one of the equations that we arrived at from the lagrangian formulation, and it expresses constancy of angular momentum.

By differentiation of Equation \( \ref{14.4.1}\) with respect to time, we see that the left hand side of Equation \( \ref{14.4.6}\) is \( m\ddot{r}\). On the right hand side of Equation \( \ref{14.4.6}\), we have \( p_{\phi}\), which is constant and equal to \( mh\sin^{2}\alpha\). Equation \( \ref{14.4.6}\) therefore becomes

\[ \ddot{r}=\frac{h^{2}\sin^{2}\alpha}{r^{3}}- g \cos \alpha, \label{14.4.9}\]

which we also derived from the lagrangian formulation.