Inertia tensors for non-typical rigid bodies
I'm trying to calculate the moment of inertia for a complex figure depending on the $r$ parameter.
c1 = Cylinder[{{0.5, 0, -1}, {0.5, 0, 1}}, 1/2]
c2 = Cylinder[{{0, 0, -1}, {0, 0, 1}}, r]
R = RegionDifference[c1, c2]
(***Inertia Field***)
vars = {x, y, z};
r2 = IdentityMatrix[3] Tr[#] - # &@Outer[Times, vars, vars];
r2 // MatrixForm
This is how it looks:
Integration works relatively well (except for computational speed) with simple figures and figures specified parametrically. But with boolean combinations, we get such a strange integral that cannot be taken.
Integrate[y^2 + z^2, vars \[Element] R, Assumptions -> {r > 0}] // AbsoluteTiming
Is there any way to get around the problem?
Version: 12.0.0 for Microsoft Windows (64-bit)
AFTER SOME TIME:
In this algorithm, the limits of integration are searched for a simpler region (cylinder), and then the triple integral is calculated. Is it possible to build an efficient computational procedure on the basis of this? This thought takes place, in my opinion, because it became possible to break the algorithm into steps and to speed up the process by simplifying at each step. What do you think?
c1 = Cylinder[{{0.5, 0, -1}, {0.5, 0, 1}}, 1/2] // Rationalize[#, 0] &;
R = c1;
(***Inertia Field***)
vars = {x, y, z};
r2 = IdentityMatrix[3] Tr[#] - # &@Outer[Times, vars, vars];
r2 // MatrixForm;
RegionMember[R, {x, y, z}];
Reduce[0 <= (1 + z)/2 <= 1 && (-(1/2) + x)^2 + y^2 <= 1/4, {x, y,
z}] // Expand;
Integrate[
Integrate[
Integrate[y^2 + z^2, {z, -1, 1}], {y, -Sqrt[x - x^2], Sqrt[
x - x^2]}], {x, 0, 1}];
$Version
to your post and also include the OS information that you are working with. $\endgroup$