# The Hamiltonian

## Conservation

### Momentum

We saw that if our Lagrangian was independent of say, $x$ or $\theta$, essentially one of the position generalized coordinates, then we could expect a conservation of momentum or angular momentum

### Energy

Now, what if the Lagrangian is independent of time? that is: $$\frac{\partial L}{\partial t} = 0$$

If so, the Energy is also conserved.

Let E be: $$E = \left( \frac{\partial L}{\partial \dot{q}_i} \dot{q}_1 \right) - L$$

(Provided the Euler-Lagrange equations generate the eqs. of motion)

$$\frac{dE}{dt} = \frac{d}{dt}\left( \frac{\partial L}{\partial \dot{q}_i} \dot{q}_1 \right) - \frac{dL}{dt}$$

\begin{aligned} \frac{dE}{dt} & = \frac{d}{dt}\left(\sum_{i=1}^N \frac{\partial L }{\partial \dot{q}_i }\dot{q}_i\right) - \frac{dL}{dt}\\ & = \sum_{i=1}^N \left( \left(\frac{d}{dt} \frac{\partial L}{\partial {\dot{q}_i}} \dot{q}_i \right) + \frac{\partial L}{\partial \dot{q}_i} \ddot{q}_i \right) - \left(\sum_{i=1}^N \left( \frac{\partial L}{\partial q_i} \dot{q_i} + \frac{\partial L}{\partial \dot{q}_i}\right) + \frac{\partial L}{\partial t}\right) \end{aligned}

Most of this cancels and we have: $$\frac{dE}{dt} = - \frac{\partial L}{\partial t}$$

Thus, given a time independent Lagrangian, we can say that total energy is conserved.

## The Hamiltonian Formulation

Take the total time derivative of the Lagrangian: $$\frac{d L(q_k, \dot{q}_k, t)}{dt} = \frac{\partial L}{dt} + \frac{\partial L}{\partial q_k}\dot{q}_k + \frac{\partial L}{\partial \dot{q}_k}\ddot{q}_k \label{eq:ddtofLagrangian}$$ (with implied summations over $k$)

Next, take the time derivative of: $$\frac{d}{dt} \left( \dot{q}_k \frac{\partial L }{\partial \dot{q}_k} \right) = \ddot{q}_k \frac{\partial L}{\partial \dot{q}_k} + \dot{q}_k \frac{d}{dt}\left(\frac{\partial L }{\partial \dot{q}_k} \right)$$

$$\frac{\partial L }{\partial t} - \frac{d}{dt}\left(L - \dot{q}_k \frac{\partial L}{\partial \dot{q}_k} \right) = 0$$

Define $H$ to be: $$H \equiv \dot{q}_k p_k - L$$

Thus: $$\frac{\partial L} {\partial t} = - \frac{dH}{dt}$$

Meaning?

If $$\frac{\partial L }{\partial t} = 0$$ then $H$ is a conserved quantity! (i.e. doesn't change in time)

Often $H = E$ (but not always)

#### Bead on a rotating parabolic wire

A bead of mass $m$ is confined to a wire that rotated around the $z$ axis. The wire is shaped like a parabola.

Speed (squared) in cylindrical coordinates: $$v^2 = \dot{\rho}^2 + \rho^2 \dot{\phi}^2 + \dot{z}^2$$ That's 3 variables, but with some constraints, it can be reduced: $$v^2 = \dot{\rho}^2 + \rho^2 \omega^2 + (2 \alpha \rho \dot{\rho})^2$$

Potential energy: $$U = m g z = m g \alpha \rho^2$$

Thus the Lagrangian: $$L = T - U = \frac{1}{2}m \left[ \left( 1 + 4 \alpha^2 \rho^2 \right) \dot{\rho}^2 + \rho^2 \omega^2 \right] - m g \alpha \rho^2$$

Next, since we only have one coordinate: $$\frac{\partial L}{\partial \rho} - \frac{d}{dt}\frac{\partial L}{\partial \dot{\rho}}$$

Eq. of motion : $$\left(1 + 4 \alpha^2 \rho^2 \right)\ddot{\rho} + 4 \alpha^2 \rho \dot{\rho}^2 + \left(2 g \alpha - \omega^2 \right)\rho = 0$$

Go back and try the generalized momentum: $$p_\rho = \frac{\partial L}{\partial \dot{\rho}} = m(1 + 4 \alpha^2 \rho^2)\dot{\rho}$$ which leads to a Hamiltonian of: $$H = \dot{\rho}p_\rho - L = m(1+4 \alpha^2 \rho^2)\dot{\rho}^2 - \frac{1}{2}m \left[ \left( 1 + 4 \alpha^2 \rho^2 \right) \dot{\rho}^2 + \rho^2 \omega^2 \right] + m g \alpha \rho^2$$

This cleans up to: $$H = \frac{1}{2}m \left[ (1+4 \alpha^2\rho^2)\dot{\rho}^2 - \rho^2 \omega^2 \right] + m g \alpha \rho^2 = \textrm{constant}$$

Compare this to the total energy $E = T + U$ (note the plus) $$E = \frac{1}{2}m \left[ \left( 1 + 4 \alpha^2 \rho^2 \right) \dot{\rho}^2 + \rho^2 \omega^2 \right] + m g \alpha \rho^2$$

Comparing the two: $$H - E = -m \rho^2 \omega^2$$