The Hamiltonian of a system is the Legendre transform of the Lagrangian. In simple cases, this gives