# Hamiltonian from a differential equation

In my differential equations course an example is given from the Lotka-Volterra system of equations:

$$x'=x-xy$$

$$y'=-\gamma y+xy.\tag{1}$$

This is then transformed by the substitution: $q=\ln x, p=\ln y$.

$$q'=1-e^p$$

$$p'=-\gamma +e^q.\tag{2}$$

Then without any explanation they say the Hamiltonian is then equal to: $$H(p,q)=\gamma q -e^q+p-e^p\tag{3}$$

How is this Hamiltonian derived?

• Is it possible that they're choosing a Hamiltonian arbitrarily for the sake of demonstration? Or have previously used a Hamiltonian which they've changed the coordinates for? – Tweej Apr 14 '16 at 14:29
• Yes, that might very well be possible. I was just wondering if from the second set of differential equations one could derive the Hamiltonian. – Joost van Geffen Apr 14 '16 at 14:30
• I fixed the malformed 2nd one of (2). Dividing the 1st by the 2nd one of (2), you see it is merely an exact differential, $dp(1-e^p)+dq(\gamma-e^q)$, trivially integrating to a constant: the L-V invariant. So it, or a function of it, is a fine candidate hamiltonian. But it works so nicely itself, so keep it! – Cosmas Zachos May 15 '16 at 22:21

It turns out, that before the non-canonical transformation $(x,y) \to (q,p)$, from the first pair of eoms (1) alone, the Hamiltonian and non-canonical Poisson bracket can be derived as $$H~=~\gamma \ln x -x +\ln y -y$$ and $$\{x,y\}_{PB} ~=~ xy,$$ respectively. Next the canonical coordinates $(q,p)$ can be easily determined.