section_path: Generalized/Hamiltonian mechanics
section_name: Hamiltonian mechanics
paragraph_text: Hamiltonian mechanics
  
  In Hamiltonian mechanics, the Lagrangian (a function of generalized coordinates and their derivatives) is replaced by a Hamiltonian that is a function of generalized coordinates and momentum. The Hamiltonian is defined as
  
  H (q, p, t) = p ⋅ q ˙ − L (q, q ˙, t), {\displaystyle {\mathcal {H}}\left(\mathbf {q},\mathbf {p},t\right)=\mathbf {p} \cdot {\dot {\mathbf {q} }}-{\mathcal {L}}\left(\mathbf {q},{\dot {\mathbf {q} }},t\right)\,,}
  
  where the momentum is obtained by differentiating the Lagrangian as above. The Hamiltonian equations of motion are
  
  q ˙ i = ∂ H ∂ p i − p ˙ i = ∂ H ∂ q i − ∂ L ∂ t = d H d t. {\displaystyle {\begin{aligned}{\dot {q}}_{i}&={\frac {\partial {\mathcal {H}}}{\partial p_{i}}}\\-{\dot {p}}_{i}&={\frac {\partial {\mathcal {H}}}{\partial q_{i}}}\\-{\frac {\partial {\mathcal {L}}}{\partial t}}&={\frac {{\text{d}}{\mathcal {H}}}{{\text{d}}t}}\,.\end{aligned}}}
  
  As in Lagrangian mechanics, if a generalized coordinate does not appear in the Hamiltonian, its conjugate momentum component is conserved.