3
$\begingroup$

I'm a newbie and I'm trying to calculate a triple integral. But Mathematica doesn't output for half an hour and the CPU occupancy rate of my Wolfram doesn't changed when it's calculating. Here is the code:

f[x_, y_, z_] = Abs[x + y + z];
Integrate[f[x, y, z] Boole[x^2 + y^2 + 4 z^2 <= 1], {x, -1, 1}, {y, -1, 1},{z, -0.5, 0.5}]

I think it shouldn't spend a lot time to calculate this; I Googled and searched, but I still can't solve. Please help me. Thanks!

$\endgroup$
7
  • $\begingroup$ Is a numerical value okay? Try NIntegrate rather than Integrate. It will give you a number in half a second. $\endgroup$
    – march
    Oct 23, 2015 at 3:50
  • 3
    $\begingroup$ After a change of (ellipsoidal) coordinates, the integral becomes Integrate[Abs[Cos[v] + 2 (Cos[u] + Sin[u]) Sin[v]] Sin[v], {u, 0, 2 π}, {v, 0, π}]/16. At least in this case, Mathematica is faster in determining that it doesn't have a clue on how to deal with it symbolically. FWIW, the integral can be expressed using the new region functionality: Integrate[Abs[x + y + z], {x, y, z} ∈ Ellipsoid[{0, 0, 0}, {1, 1, 1/2}]]. $\endgroup$ Oct 23, 2015 at 5:30
  • 5
    $\begingroup$ You can transform the ellipsoid region to a unit ball, and align the norm of plane $x+y+z=0$ (should be something like $x+y+\zeta/2 = 0$ under new coord system) to the new $z$ axis, then you'll find yourself a very simple integral which can be symbolically done by Mathematica in seconds to get an exact answer $\frac{3 \pi }{8}$. $\endgroup$
    – Silvia
    Oct 23, 2015 at 6:42
  • $\begingroup$ @Silvia How about giving an answer :) ? $\endgroup$
    – xzczd
    Nov 10, 2015 at 5:51
  • 2
    $\begingroup$ Here's one way to do @Silvia's lovely approach: tr = Composition[ScalingTransform[{1, 1, 1/2}], RotationTransform[{{0, 0, 1}, {1, 1, 1/2}}]]; Integrate[(Abs[x + y + z] /. Thread[{x, y, z} -> tr[{x, y, z}]]) Det[D[tr[{x, y, z}], {{x, y, z}}]], {x, y, z} ∈ Ball[]] $\endgroup$ Nov 10, 2015 at 7:30

1 Answer 1

2
$\begingroup$

This could be an option:

RegionPlot3D[
 x^2 + y^2 + 4 z^2 <= 1, {x, -1, 1}, {y, -1, 1}, {z, -0.5, 0.5}]

enter image description here

$\endgroup$
1
  • 2
    $\begingroup$ How does this answer the question about Integrate? $\endgroup$ Aug 4, 2017 at 12:55

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.