1
$\begingroup$

So have this code (giving the moment of inertia of a cube)

Integrate[x^2 + y^2, 
          {x, y, z} ∈ ImplicitRegion[Max[Abs[x], Abs[y], Abs[z]] < 1, {x, y, z}]]

which works fine giving 16/3. But when I replace 1 by an abstract parameter a like in

Integrate[x^2 + y^2, 
          {x, y, z} ∈ ImplicitRegion[Max[Abs[x], Abs[y], Abs[z]] < a, {x, y, z}]]

I only get something obvious like the following: Mathematica output

How can I make Mathematica use the formal parameter?

$\endgroup$
  • $\begingroup$ If you would not need implicit regions you could do this: Integrate[ x^2 + y^2, {x, y, z} \[Element] Cuboid[a {-1, -1, -1}, a {1, 1, 1}]] which leads to: ConditionalExpression[(16 a^5)/3, a > 0] but that will probably not solve your problem $\endgroup$ – Ruud3.1415 Jul 21 '17 at 13:48
  • $\begingroup$ I'm aware of Mathematica's predefined Regions, but I do need ImplicitRegion for my actual problem $\endgroup$ – chr Jul 21 '17 at 14:05
  • $\begingroup$ That's what I thought (since this problem is of course solvable without the regions). I thought putting the assumption in that a is larger than 0 would help solve it, but that also did not seem to work. $\endgroup$ – Ruud3.1415 Jul 21 '17 at 14:10
  • $\begingroup$ Adding that assumption also was my first try $\endgroup$ – chr Jul 21 '17 at 15:21
1
$\begingroup$

maybe rewritting your implicit region as:

Integrate[x^2 + y^2, {x, y, z} \[Element] 
  ImplicitRegion[-a <= x <= a && -a <= y <= a && -a <= z <= a, {x, y, 
    z}], Assumptions -> a > 0]

(* (16 a^5)/3 *)
| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks! Seems that Region doesn't like Abs $\endgroup$ – chr Jul 31 '17 at 17:17
  • 1
    $\begingroup$ Well, Region does like Abs :-) It needs a clear definition of the region: region = ImplicitRegion[Max[Abs[{x, y, z}]] < a, {{x, -a, a}, {y, -a, a}, {z, -a, a}}], then: Integrate[x^2 + y^2, Element[{x, y, z}, region], Assumptions -> a > 0] which gives ((16 a^5)/3). $\endgroup$ – djg Jul 31 '17 at 23:54
0
$\begingroup$

MMA tries to figure out the implicit region without no assumptions about $\{x,y,z\}$ or $a$, so we can tell it what to do in specific cases:

 Integrate[x^2 + y^2, {x, y, z} \[Element] ImplicitRegion[
 Evaluate@Reduce[Max[Abs[x], Abs[y], Abs[z]] < a, {x, y, z}, Reals], {x, y, z}]]

$\begin{array}{cc} \bigg\{ & \begin{array}{cc} \frac{16 a^5}{3} & a>0 \\ 0 & \text{True} \\ \end{array} \\ \end{array}$

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.