# Hamiltonian equation in Cartesian coordinates

My Lagrangian equation is $$L = \dfrac{1}{2}m\dot{q}^{2} \tag{1},$$ where $q=(x,y)$. Performing the Legendre transformation I get the Hamiltonian equation, \begin{equation} H(p,q) =p\dot{q}-\dfrac{1}{2}m\dot{q}^{2}\tag{2}. \end{equation}

Now from the Lagrange equations it follows obviously that $p=m\dot{q}$ which gives that, $H(p,q)= \dfrac{1}{2}m\dot{q}^{2}$. If I put this hamiltonian equation in cartesian coordinates $(x,y)$ then my Hamiltonian will become, \begin{equation} H(x,y) = \dfrac{1}{2}m(\dot{x}^{2}+\dot{y}^{2}).\tag{3} \end{equation}

My question is as follows:

Are my $dH$ and my Hamiltonian vector field $X_{H}$ defined as follows?

\begin{equation} dH(x,y) = \dfrac{\partial H}{\partial x}dx + \dfrac{\partial H}{\partial y}dy \\ X_{H} = \dfrac{\partial H}{\partial x }\dfrac{\partial}{y} -\dfrac{\partial H}{\partial y}\dfrac{\partial}{\partial x}. \end{equation}

or as this?

\begin{equation} dH(p_{x},p_{y},x,y) = \dfrac{\partial H}{\partial x}dx + \dfrac{\partial H}{\partial y}dy +\dfrac{\partial H}{\partial p_{x}}dp_{x} + \dfrac{\partial H}{\partial p_{y}}dp_{y} \\ X_{H} = \dfrac{\partial H}{\partial x }\dfrac{\partial}{p_{x}} -\dfrac{\partial H}{\partial p_{x}}\dfrac{\partial}{\partial x}+\dfrac{\partial H}{\partial y }\dfrac{\partial}{p_{y}} -\dfrac{\partial H}{\partial p_{y}}\dfrac{\partial}{\partial y}. \end{equation}

1. Note that OP's function (3) in it current form (v3) is the Lagrangian energy function $$h(q,\dot{q},t)~:=~\sum_{i=1}^n\dot{q}^i\frac{\partial L(q,\dot{q},t)}{\partial \dot{q}^i}-L(q,\dot{q},t);$$ not the Hamiltonian $H(q,p,t)$ as OP claims. The two functions have same value, but depend on different arguments. In fact, the Lagrangian and the Hamiltonian formalism are connected via a Legendre transformation between the variables $\dot{q}$ and $p$.

2. The Hamiltonian vector field $X_H\in\Gamma(T^{\ast}M)$ [with the Hamiltonian$^1$ $H(q,p)$ as generator] is a vector field on the cotangent bundle/phase space $T^{\ast}M$; not on the configuration space $M$.

--

$^1$ Assume for simplicity no explicit time dependence.

In simplified words said the purpose of the Hamiltonian formalism is to eliminate the velocities $\dot{q}$ in favour of the momenta $p$. When you combine $p=m\dot{q}$ with $H=\frac{1}{2}m \dot{q}^2$, the velocity $\dot{q}$ should be eliminated in favour of $p$. If this is done we get ( in 2 dimensions):

$H = \frac{p^2}{2m} \equiv \frac{p_1^2}{2m} + \frac{p_2^2}{2m}$

which only depends on $p$. In that case the components of the Hamiltonian vector field are

$X_H = \left( \frac{\partial H}{\partial p_i}, -\frac{\partial H}{\partial q_i}\right) = (p_i, 0)$

if you like them expanded in a base of tangential vectors in 2 dimensions.

$X_H = p_1 \frac{\partial }{\partial q_1} + p_2 \frac{\partial }{\partial q_2} + 0 \frac{\partial }{\partial p_1} + 0 \frac{\partial }{\partial p_2} = p_1 \frac{\partial }{\partial q_1} + p_2 \frac{\partial }{\partial q_2}$

The symplectic 2-form in 2 dimensions is independent of the dependency of $H$ on $q$ and $p$: $dq_1\wedge dp_1 + dq_2\wedge dp_2$. Because the phase space of a 2-dimensional problem is always the same. Of course the curves $H(q,p)=const$ (here $H(p)=const$) in the phase space might be different for each different 2-dim. problem.