Liouville integrability of the isotropic harmonic oscillator (source code)

= Liouville integrability of the isotropic harmonic oscillator

For
$$
H=\frac12\sum_{j=1}^n(q_j^2+p_j^2),
$$
the functions $I_j=(q_j^2+p_j^2)/2$ are independent almost everywhere, Poisson commute, and sum to $H$. A regular common level $I_j=c_j>0$ is the product of circles of radii $\sqrt{2c_j}$, hence an invariant $n$-torus. Allowing some $c_j=0$ gives lower-dimensional singular tori.