How can I compute this triple integral?

enter image description here

I tried this but it has been running for a long time and not return result yet.

 Boole[0 <= x^2 + y^2 + z^2 <= 4]*((y - 1)^3/(x^2 + y^2 + z^2 + 1)), {x, 0, 2}, {y, -2, 
  2}, {z, -2, 2}]
  • 1
    $\begingroup$ NIntegrate will give a numerical value (-16.755...) $\endgroup$
    – mikado
    Apr 16 at 20:26
  • 1
    $\begingroup$ @mikado that seems right. Someone got -16π/3, why is it hard for Mathematica to get the exact result? $\endgroup$
    – hana
    Apr 16 at 20:29
  • 1
    $\begingroup$ @hana If I had to guess (and I would be), because "work over this prism and then test membership in a hemisphere" is harder to work with than "work over this sphere and then test membership in a hemisphere", and that the latter likely makes Mathematica more likely to try certain methods (e.g. it knows a sphere is relevant from the domain specification, so will try spherical coordinates etc.). The domain as a prism doesn't lead it to realize a sphere is present, as that's been coded into the function rather than the domain, so it doesn't try those methods. But, again: just a guess. $\endgroup$
    – Zibadawa
    Apr 17 at 11:53

2 Answers 2

 Boole[x >= 0]*((y - 1)^3/(x^2 + y^2 + z^2 + 1)), {x, y, 
   z} ∈ Ball[{0, 0, 0}, 2]]

-((16 π)/3)


Changing to spherical polar coordinates gives an answer that agrees numerically

π Integrate[(r^2 Cos[θ] (r Sin[θ] - 1)^3)/(r^2 + 1), {r, 0, 2}, {θ, -π/2, π/2}]
(* -((16 π)/3) *)

But doesn't explain why Mathematica struggles with the Cartesian formulation.


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.