Solution (source code)

= Solution

For a rigid body about a chosen origin,
$$
I_{ij}=\int\rho(\mathbf r)(r^2\delta_{ij}-r_ir_j)\,dV,
\qquad \mathbf L=\mathbf I\boldsymbol\omega,
\qquad T_{\rm rot}=\frac12\boldsymbol\omega\cdot\mathbf I\boldsymbol\omega.
$$
The <inertia tensor> is real and symmetric, so <orthogonal> <principal axes> diagonalize it. <Angular momentum> is parallel to <angular velocity> for rotation about a <principal axis>, but need not be parallel in a general direction. Its <eigenvalues> are the <principal moments of inertia>.

If the origin is translated from the <centre of mass> by $\mathbf a$, the parallel-axis theorem becomes $I_{ij}=I_{ij}^{\rm CM}+M(a^2\delta_{ij}-a_ia_j)$. In body axes, Euler's equation is $\boldsymbol\tau=(d\mathbf L/dt)_{\rm body}+\boldsymbol\omega\times\mathbf L$. Thus \b[the full <tensor> is needed whenever the rotation is not confined to one fixed <principal axis>].