Solution (source code)

= Solution

A Hamiltonian system on a $2n$-dimensional symplectic manifold is completely integrable when it has $n$ first integrals $F_1=H,F_2,\ldots,F_n$ whose differentials are independent on the regular set and which are in involution:
$$
\{F_i,F_j\}=0\qquad\text{for all }i,j.
$$

The Arnold--Liouville theorem states that every compact connected regular common level set of these integrals is an $n$-torus. In a neighbourhood of it there are action--angle coordinates $(I_1,\ldots,I_n,\theta_1,\ldots,\theta_n)$ in which
$$
\omega=\sum_{i=1}^n dI_i\wedge d\theta_i,
\qquad
H=H(I),
$$
and Hamilton's equations become
$$
\dot I_i=0,
\qquad
\dot\theta_i=\frac{\partial H}{\partial I_i}.
$$
\b[Thus the motion on each invariant torus is linear in the angles.]