Solution (source code)

= Solution

In canonical coordinates, <Hamilton's equations> are
$$
\boxed{\dot q_i=\frac{\partial H}{\partial p_i},\qquad
\dot p_i=-\frac{\partial H}{\partial q_i}\quad(1\leq i\leq n).}
$$
A function $F(q,p)$ is an <integral of motion> if it is constant along every <Hamiltonian flow>, equivalently
$$
\dot F=\{F,H\}=0
$$
for a time-independent $F$. The system is an <integrable Hamiltonian system> when it has $n$ first integrals $F_1,\ldots,F_n$ whose <total differential>[differentials] are linearly independent almost everywhere and which are in mutual <Poisson bracket>[Poisson involution]: $\{F_i,F_j\}=0$ for all $i,j$.