# Hamiltonian

The Hamiltonian is a quantity of great importance in both classical and quantum mechanics.

## Classical mechanics

In classical dynamics, the Hamiltonian is defined to be

$H=\sum_i p_i \dot{q_i} - L$

where qi are the generalised coordinates and pi are the momenta conjugate to these coordinates, and L is the Lagrangian. For many problems the Hamiltonian is the same as the energy.

The Hamilton equations are:

$\dot p_i = -\frac{\partial H}{\partial q_i}$
$\dot q_i =~~\frac{\partial H}{\partial p_i}.$

### Example

For a mass m attached to a spring of spring constant k extended by a distance x, $L=m\dot{x}^2/2-kx^2/2$. The momentum $p = \frac{\partial L}{\partial \dot x} = m \dot x$ and so

$H = p\dot{x} - L$

$H = \frac{p^2}{2m}+\frac{kx^2}{2}$

which is the familiar expression for the energy of a simple harmonic oscillator.

The equations of motion are:

$\dot p = -\frac{\partial H}{\partial x} = -kx$
$\dot x =~~\frac{\partial H}{\partial p_i} = p/m$.

Inserting $p = m \dot x$ this into the first equation, we get $m \ddot x = -kx$. This is just Newton's second law, F = ma.

## Quantum mechanics

The Hamiltonian for many quantum mechanical systems can be obtained by writing down a corresponding classical Hamiltonian and promoting all of the coordinates and momenta to operators. The quantum mechanical Hamiltonian is of central importance to the Schrodinger equation.