Richard P. answered 11/04/19
PhD in Physics with 10+ years tutoring experience in STEM subjects
For the case of a rigid body (such as a wooden top), the first step is to locate the center of mass (CM) of the object. This CM will be the origin of coordinates for the integrations below. There will be a mass density function ρ(x,y,z) such that ρ is zero outside of the object boundary. In many cases ρ will be a constant inside the object boundary ( for example the density of wood). The orientation of the x,y,z axes with respect to the structure of ρ is, in principle, arbitrary. However, if there is a symmetry axis (or axes), it is best to pick the z axis along the symmetry direction.
The next step is to compute the elements of the 3 x 3 moment of inertia tensor, I, as:
Izz = ∫ ρ(x,y,x) (x2 + y2) dx dy dz
Ixx = ∫ ρ(x,y,x) (z2 + y2) dx dy dz
Iyy = ∫ ρ(x,y,x) (x2 + z2) dx dy dz
Ixy = - ∫ ρ(x,y,x) (xy) dx dy dz = Iyx
Ixz = - ∫ ρ(x,y,x) (xz) dx dy dz = Izx
Iyz = - ∫ ρ(x,y,x) (yz) dx dy dz = Izy
These integrals are over the volume of the object. Evaluation of these integrals is very difficult if the object has no symmetry axes.
The next step is to note a general mathematical result. That is, for a symmetric tensor such as I, there will in general be a rotation matrix, Q, the brings this tensor into diagonal form. The equation for this is
Λ = Q I QT for some rotation matrix Q. Λ is diagonal matrix whose elements are the principle values of the moment of inertia tensor. The right hand side is the product of three 3x3 matrices. The ' T ' denotes transpose. Once Q is found, the elements of Λ are easy to work out. Finding Q is quite difficult in the general case. However, engineering codes, such a MATLAB, have built in routines for computing Q.
Hope this helps.