Solution (source code)

= Solution

Let $e_1,e_2,e_3$ be a <principal body frame>, let $I_1,I_2,I_3$ be the corresponding principal <moments of inertia>, and write the <angular velocity> as $\boldsymbol\omega=\sum_i\omega_i e_i$. The body-frame components of the <angular momentum> are
$$
\mathbf L=\sum_{i=1}^3 I_i\omega_i e_i.
$$
No external torque acts, so $\mathbf L$ is constant in the <fixed space frame>. Since a body-fixed basis vector satisfies $\dot e_i=\boldsymbol\omega\times e_i$,
$$
0=\left(\frac{d\mathbf L}{dt}\right)_{\rm space}
=\left(\frac{d\mathbf L}{dt}\right)_{\rm body}
+\boldsymbol\omega\times\mathbf L.
$$
Taking body-frame components gives the <Euler equations for a torque-free rigid body>:
$$
\boxed{
\begin{aligned}
I_1\dot\omega_1&=(I_2-I_3)\omega_2\omega_3,\\
I_2\dot\omega_2&=(I_3-I_1)\omega_3\omega_1,\\
I_3\dot\omega_3&=(I_1-I_2)\omega_1\omega_2.
\end{aligned}}
$$