Hamiltonian mechanics (source code)

= Hamiltonian mechanics
{c}
{wiki}

<Hamiltonian mechanics> describes motion using coordinates $q_i$ and their <canonical momenta> $p_i$. A <Hamiltonian> $H(q,p,t)$ generates evolution through <Hamilton's equations>:
$$
\dot q_i=\frac{\partial H}{\partial p_i},\qquad \dot p_i=-\frac{\partial H}{\partial q_i}.
$$
The pair $(q,p)$ is a point in <phase space>; these first-order equations specify its velocity there.

For a spring oscillator, $H=p^2/(2m)+kq^2/2$ gives $\dot q=p/m$ and $\dot p=-kq$, recovering <Newton's second law>. The formulation treats position and momentum together and makes <canonical transformations>, <Poisson brackets> and conservation laws especially useful. An autonomous Hamiltonian is conserved along its motion. The underlying <symplectic form> also restricts how phase-space regions evolve, leading to <Liouville's theorem>.