The Hamiltonian is equivalent to the below

It is the total energy within the system. See equation 7.130 in the theoretical mechanics textbook for a derivation.

The Hamiltonian is equivalent to the total energy if the following conditions are met:

  • The equations connecting generalized to rectangular/whatever-system-you’re using have to be non-time dependent
  • Potential energy can’t be velocity dependent