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?