Hamiltonian mechanics

Documentation, printout reviewed by @pleroy.