I want to visualize in 3d intersecting bodies and compute the volume of their intersection at the same time. It would be very nice if I can rotate 3d view and switch between bodies. If it is too hard or takes long time, it is ok for me to have 3 different 3d view in a document.

My bodies are given by inequalities:

  1. $x^2+y^2+z^2 \ge 10z;$ $x^2+y^2-2z \le 12$.
  2. $x^2+y^2+z^2 -24\le -2z;$ $2 \sqrt{x^2+y^2} \le z+3$.
  3. $x^2+y^2+z^2 +6z\le 16;$ $x^2+y^2+z^2 -6z\le 4$.

Can you please help me?


My current code:

R = 
    x^2 + y^2 + z^2 + 6 z <= 16 && x^2 + y^2 + z^2 - 6 z <= 4, {x, y, z}]
Show[{R, DiscretizeRegion[ℛ, RegionBounds[R]]}]

Positive things:

$\quad$I can compute the volume of the intersection.

Negative things:

  1. My 3D view show shows something wrong. In my case it should be intersection of two spheres and it shows something close to it, but not what it must be. - SOLVED.
  2. I want to extract the equation of the boundaries to compute multiple integrals, but I do not see how to do it. If possible I want to get cylindrical and spherical boundaries as well.
  3. I do not see the coordinate axes in my 3D view.

Important question on borders:

With my tiny brain I can deduce borders of the region:

  {x, -3, 3}, 
  {y, -Sqrt[9 - x^2], Sqrt[9 - x^2]}, 
  {z, 3 - Sqrt[13 - x^2 - y^2], -3 + Sqrt[25 - x^2 - y^2]}]

How can I extract this information from region $R$? I am interested in Cartesian, cylindrical and spherical coordinates at the same time. $R$ must store at least one these representations internally.

  • 2
    $\begingroup$ What have you tried so far? Have you converted the formulas to Mathematica syntax? Have you looked at RegionPlot3D, ContourPlot3D, ImplicitRegion, RegionIntersection, Volume? $\endgroup$
    – Szabolcs
    Commented May 21, 2017 at 17:14
  • $\begingroup$ I've updated my answer and posted code, please check it. $\endgroup$
    – Hedgehog
    Commented May 21, 2017 at 17:30
  • $\begingroup$ Ok, it is getting better, can you please check my question about borders of region? Thanks! $\endgroup$
    – Hedgehog
    Commented May 21, 2017 at 17:49
  • 1
    $\begingroup$ For the borders: look up CylindricalDecomposition[]. For the axes: Show[(* stuff *), Axes -> True] $\endgroup$ Commented May 21, 2017 at 18:31
  • $\begingroup$ @J. M. Wow, thanks! One last (but very important thing). CylindricalDecomposition gives me Cartesian coordinates. How can I get cylindrical and spherical coordinates from them with Mathematica? Thanks again! $\endgroup$
    – Hedgehog
    Commented May 21, 2017 at 18:57

1 Answer 1


I think the intersection is right and what you are seeing is how it should be. see the two spheres below

enter image description here

  • $\begingroup$ It is correct with BoundaryDiscretizieRegion, but it failed with DiscretizieRegion. Please check my question re borders. $\endgroup$
    – Hedgehog
    Commented May 21, 2017 at 17:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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