Hamiltonian mechanics
From Academic Kids

Hamiltonian mechanics is a reformulation of classical mechanics that was invented in 1833 by William Rowan Hamilton. It arose from Lagrangian mechanics, another reformulation of classical mechanics, introduced by Joseph Louis Lagrange in 1788. It can however be formulated without recourse to Lagrangian mechanics, using symplectic spaces. See the section on its mathematical formulation for this.
Contents 
As a reformulation of Lagrangian mechanics
Starting with Lagrangian mechanics, the equations of motion are based on generalized coordinates
 <math>\left\{\, q_j  j=1,...,N \,\right\}. <math>
and matching generalized velocities
 <math>\left\{\, \dot{q}_j  j=1,...,N \,\right\}. <math>
Abusing the notation, we write the Lagrangian as
 <math>L(q_j, \dot{q}_j, t),<math>
with the subscripted variables understood to represent all N variables of that type. Hamiltonian mechanics aims to replace the generalized velocity variables with generalized momentum variables, also known as conjugate momenta. By doing so, it is possible to handle certain systems, such as aspects of quantum mechanics that would otherwise be even more complicated.
For each generalized velocity, there is one corresponding conjugate momentum, defined as:
 <math>p_j = {\partial L \over \partial \dot{q}_j}.<math>
In Cartesian coordinates, the generalized momenta are precisely the physical linear momenta. In circular polar coordinates, the generalized momentum corresponding to the angular velocity is the physical angular momentum. For an arbitrary choice of generalized coordinates, it may not be possible to obtain an intuitive interpretation of the conjugate momenta.
One thing which is not too obvious in this coordinate dependent formulation is that different generalized coordinates are really nothing more than different coordinatizations of the same symplectic manifold.
The Hamiltonian is the Legendre transform of the Lagrangian:
 <math>H\left(q_j,p_j,t\right) = \sum_i \dot{q}_i p_i  L(q_j,\dot{q}_j,t).<math>
If the transformation equations defining the generalized coordinates are independent of t, it can be shown that H is equal to the total energy E = T + V.
Each side in the definition of H produces a differential:
 <math>\begin{matrix}
dH &=& \sum_i \left[ \left({\partial H \over \partial q_i}\right) dq_i + \left({\partial H \over \partial p_i}\right) dp_i \right] + \left({\partial H \over \partial t}\right) dt\qquad\qquad\quad\quad \\ \\
&=& \sum_i \left[ \dot{q}_i\, dp_i + p_i\, d\dot{q}_i  \left({\partial L \over \partial q_i}\right) dq_i  \left({\partial L \over \partial \dot{q}_i}\right) d\dot{q}_i \right]  \left({\partial L \over \partial t}\right) dt.
\end{matrix}<math>
Substituting the previous definition of the conjugate momenta into this equation and matching coefficients, we obtain the equations of motion of Hamiltonian mechanics, known as the canonical equations of Hamilton:
 <math>
{\partial H \over \partial q_j} =  \dot{p}_j, \qquad {\partial H \over \partial p_j} = \dot{q}_j, \qquad {\partial H \over \partial t } =  {\partial L \over \partial t}. <math>
Hamilton's equations are firstorder differential equations, and thus easier to solve than Lagrange's equations, which are secondorder. However, the steps leading to the equations of motion are more onerous than in Lagrangian mechanics  beginning with the generalized coordinates and the Lagrangian, we must calculate the Hamiltonian, express each generalized velocity in terms of the conjugate momenta, and replace the generalized velocities in the Hamiltonian with the conjugate momenta. All in all, there is little labor saved from solving a problem with Hamiltonian mechanics rather than Lagrangian mechanics. Ultimately, it will produce the same solution as Lagrangian mechanics and Newton's laws of motion.
The principal appeal of the Hamiltonian approach is that it provides the groundwork for deeper results in the theory of classical mechanics.
A more geometric way of seeing this is to note we have a fiber bundle E over time, R with the fibers E_{t}, <math>t\in\mathbb{R}<math> being the position space and the Lagrangian is a function over the jet bundle JE. Taking the fiberwise Legendre transform of the Lagrangian, we get a function called the Hamiltonian over the dual bundle over time whose fiber at t is the cotangent space T^{*}E_{t}, which comes equipped with a natural symplectic form.
Mathematical formalism
Any smooth realvalued function H on a symplectic manifold can be used to define a Hamiltonian system. The function H is known as the Hamiltonian or the energy function. The symplectic manifold is then called the phase space. The Hamiltonian induces a special vector field on the symplectic manifold, known as the symplectic vector field.
The symplectic vector field, also called the Hamiltonian vector field, induces a Hamiltonian flow on the manifold. The integral curves of the vector field are a oneparameter family of transformations of the manifold; the parameter of the curves is commonly called the time. The time evolution is given by symplectomorphisms. By Liouville's theorem, each symplectomorphism preserves the volume form on the phase space. The collection of symplectomorphisms induced by the Hamiltonian flow is commonly called the Hamiltonian mechanics of the Hamiltonian system.
The Hamiltonian vector field also induces a special operation, the Poisson bracket. The Poisson bracket acts on functions on the symplectic manifold, thus giving the space of functions on the manifold the structure of a Lie algebra.
In particular, given a function f
 <math>\frac{d}{dt} f=\frac{\partial }{\partial t} f + \{\,f,H\,\}.<math>
If we have a probability distribution, ρ, then (since the phase space velocity (<math> {\dot p_i} , {\dot q _i} <math>) has zero divergence, and probability is conserved) its convective derivative can be shown to be zero and so
 <math>\frac{\partial}{\partial t} \rho =  \{\,\rho ,H\,\}.<math>
This is called Liouville's theorem. Every smooth function G over the symplectic manifold generates a oneparameter family of symplectomorphisms and if { G, H } = 0, then G is conserved and the symplectomorphisms are symmetry transformations.
Note that in general, the integrability of Hamiltonian vector fields is an open question. In general, Hamiltonian systems are chaotic; concepts of measure, completeness, integrability and stability are poorly defined. At this time, the study of dynamical systems is primarily qualitative, and not a quantitative science.
Riemannian manifolds
An important special case consists of those Hamiltonians that are quadratic forms, that is, Hamiltonians that can be written as
 <math>H(q,p)= \frac{1}{2} \langle p,p\rangle_q<math>
where <math>\langle\cdot,\cdot\rangle_q<math> is a cometric on the fiber <math>T_q^*Q<math>, the cotangent space to the point q in the configuration space. Note that this Hamiltonian consists entirely of the kinetic term.
If one considers a Riemannian manifold or a pseudoRiemannian manifold, so that one has an invertible, nondegenerate metric, then the cometric is given simply as the inverse of the metric. The solutions to the HamiltonJacobi equations for this Hamiltonian are then the same as the geodesics on the manifold. In particular, the Hamiltonian flow in this case is the same thing as the geodesic flow. The existence of such solutions, and the completeness of the set of solutions, are discussed in detail in the article on geodesics.
SubRiemannian manifolds
When the cometric is degenerate, then it is not invertible. In this case, one does not have a Riemannian manifold, as one does not have a metric. However, the Hamiltonian still exists. In the case where the cometric is degenerate at every point q of the configuration space manifold Q, so that the rank of the cometric is less than the dimensionality of the manifold Q, one has a subRiemannian manifold.
The Hamiltonian in this case is known as a subRiemannian Hamiltonian. Every such Hamiltonian uniquely determines the cometric, and viceversa. This implies that every subRiemannian manifold is uniquely determined by its subRiemannian Hamiltonian, and that the converse is true: every subRiemannian manifold has a unique subRiemannian Hamiltonian. The existence of subRiemannian geodesics is given by the ChowRashevskii theorem.
The continuous, realvalued Heisenberg group provides a simple example of a subRiemannian manifold. For the Heisenberg group, the Hamiltonian is given by
 <math>H(x,y,z,p_x,p_y,p_z)=\frac{1}{2}\left( p_x^2 + p_y^2 \right)<math>.
Note that <math>p_z<math> is not involved in the Hamiltonian.
Poisson algebras
Hamiltonian systems can be generalized in various ways. Instead of simply looking at the algebra of smooth functions over a symplectic manifold, Hamiltonian mechanics can be formulated on general commutative unital real Poisson algebras. A state is a continuous linear functional on the Poisson algebra (equipped with some suitable topology) such that for any element A of the algebra, A^{2} maps to a nonnegative real number.
A further generalization is given by Nambu dynamics.
References
 Ralph Abraham and Jarrold E. Marsden, Foundations of Mechanics, (1978) BenjaminCummings, London ISBN 080530102X
 Rychlik, Marek, "Lagrangian and Hamiltonian mechanics  A short introduction (http://alamos.math.arizona.edu/~rychlik/557dir/mechanics/)"
 Binney, James, "Classical Mechanics (http://wwwthphys.physics.ox.ac.uk/users/JamesBinney/CMech_notes.ps)" (PostScript) [lecture notes (http://wwwthphys.physics.ox.ac.uk/users/JamesBinney/cmech.pdf)] (PDF)de:HamiltonFormalismus
es:Mecánica hamiltoniana fr:Mécanique hamiltonienne ja:ハミルトン力学