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!
NIntegrate
rather thanIntegrate
. It will give you a number in half a second. $\endgroup$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$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$