Hamiltonian


The Hamiltonian HH of a conservative system is the Legendre transform of its Lagrangian LL:

H(p,q,t)(pq˙L(q,q˙,t))q˙i=ui(p,q,t)H(p,q,t)\equiv\left.{(\mathbf{p}\cdot \dot{\mathbf{q}}-L(q,\dot{q},t))}\right|_{\dot{q}_{i}=u_{i}(p,q,t)}

q\mathbf{q} are the generalized coordinates, p\mathbf{p} are the conjugate momenta and u(p,q,t)=q˙u(p,q,t)=\dot{\mathbf{q}} is a vector field that finds the velocities from (p,q,t)(p,q,t). In mechanical systems, it coincides with the total energy:

H=T+VH=T+V

where TT is the kinetic energy and VV is the potential energy. The Hamiltonian changes in the opposite sense as the Lagrangian:

Ht=Lt\frac{ \partial H }{ \partial t } =-\frac{ \partial L }{ \partial t }

The Hamiltonian is used in the Hamilton equations of the system to find its trajectory.

Examples

> for some potential energy $V$. The Lagrangian is $L=T-V$. We want to show that the Hamiltonian is instead $H=T+V$. To do that, we'll express the kinetic energy in terms of the [[Linear momentum|momentum]] instead of velocity: > $$p_{x}=\frac{ \partial L }{ \partial \dot{x} } =m \dot{x},\quad p_{y}=\frac{ \partial L }{ \partial \dot{y} } =m \dot{y},\quad p_{z}=\frac{ \partial L }{ \partial \dot{z} } =m \dot{z}

Hence

> The grand majority of Hamiltonians in physics have this form: $\mathbf{p}^{2}/2m$ plus a potential. This is because [[Cartesian coordinates]] are ubiquitous, as is considering point masses as objects, but it is a matter of "habit". This is not, *in general*, the shape of a Hamiltonian, as that depends on other factors such as the choice of coordinates. It just happens to be an overwhelmingly common specific case. > [!example] Harmonic oscillator > Using the same process of expressing kinetic energy in terms of momentum, the Hamiltonian of a (one-dimensional) [[harmonic oscillator]] is > $$H=\frac{p^{2}}{2m}+ \frac{1}{2}m\omega ^{2}q^{2} > where we used the [[electric potential]] $\phi$ and the [[magnetic vector potential]] $\mathbf{A}$. $e$ is the [[electric charge]] (since $q$ is already taken by position). We'll use the [[Lagrange equation]] to find the Hamiltonian through its definition. Firstly, > $$p_{i}=\frac{ \partial L }{ \partial \dot{q}_{i} } =m \dot{q}_{i}+eA_{i},\quad \dot{q}_{i}=\frac{p_{i}}{m}- \frac{e}{m}A_{i}

and using the Hamiltonian definition

H(p,q)&=\mathbf{p}\cdot \dot{\mathbf{q}}-L|_{\dot{\mathbf{q}}=\frac{p_{i}}{m}- \frac{e}{m}A_{i}} \\ &=\frac{\mathbf{p}^{2}}{m}- \frac{e}{m}\mathbf{A}\cdot \mathbf{p}- \frac{m}{2} \frac{(\mathbf{p}-e\mathbf{A})^{2}}{m^{2}}- \frac{e}{m}(\mathbf{p}-e\mathbf{A})\cdot \mathbf{A}+e\phi \\ &=\frac{(\mathbf{p}-e\mathbf{A})^{2}}{m}- \frac{(\mathbf{p}-e\mathbf{A})^{2}}{2m}+e\phi \\ &=\frac{(\mathbf{p}-e\mathbf{A})^{2}}{2m}+e\phi \end{align}