# Hamiltonian mechanics

Equivalent to Lagrangian mechanics but formulated in a different way.
TODO understand original historical motivation, www.youtube.com/watch?v=SZXHoWwBcDc says it is from optics.
Intuitively, the Hamiltonian is the total energy of the system in terms of arbitrary parameters, a bit like Lagrangian mechanics.

## Lagrangian vs Hamiltonian

The key difference from Lagrangian mechanics is that the Hamiltonian approach groups variables into pairs of coordinates called the phase space coordinates:
• generalized coordinates, generally positions or angles
• their corresponding conjugate momenta, generally velocities, or angular velocities
This leads to having two times more unknown functions than in the Lagrangian. However, it also leads to a system of partial differential equations with only first order derivatives, which is nicer. Notably, it can be more clearly seen in phase space.

## Hamilton's equations

Analogous to what the Euler-Lagrange equation is to Lagrangian mechanics, Hamilton's equations give the equations of motion from a given input Hamiltonian:
So once you have the Hamiltonian, you can write down this system of partial differential equations which can then be numerically solved.