I am working on a tumor model and need to calculate the volume enclosed between the sphere given by

$$(x-d)^2+y^2+z^2=r^2$$ and the cylinder given by $$x^2+y^2=R^2.$$

I have worked it out by using surfaces of revolution but this is tedious and required numerous cases. When I try to use cylindrical coordinates I end up the integral $$\int^{2\pi}_0 \int^R_0 \int^{\sqrt{r^2-R^2+d^2-2dR\cos (\theta )}}_{-\sqrt{r^2-R^2+d^2-2dR\cos (\theta )}} R~dz~dR~d\theta$$ which won't compute. I suspect either I am making an error in my transformation to cylindrical coordinates or a different method is needed.

  • 1
    $\begingroup$ When you say "area enclosed," do you mean "volume enclosed?" $\endgroup$
    – Mark Viola
    Apr 22 '15 at 1:53
  • $\begingroup$ yes; edited. Thank you. $\endgroup$
    – J. Kennedy
    Apr 22 '15 at 2:07

Watch out. You're mixing constants and variables ($R$ is a constant in the cylinder equation but a variable in the integral). Let's employ some revised definitions. Let the radius of the sphere be $A$ and that of the cylinder be $R$. We're looking for the volume enclosed between these two surfaces:



Note that by symmetry, the volume enclosed above the $xy$ plane is equal to the volume enclosed below it. We'll integrate for the top half of the volume from $z=0$ up to $z$ at the sphere, then double the result.

Knowing this, we can employ a double integral over the circular region in the $xy$ plane. We'll integrate the function $z = \sqrt{A^2 -(x-d)^2 -y^2}$. Since we'll use polar coordinates $(r,\theta)$, we express $z$ as $z= f(r,\theta)$ using $x=r\cos\theta$ and $y=r\sin\theta$.

$$z = f(r,\theta) = \sqrt{A^2 -d^2 -r^2 + 2rd\cos\theta}$$

$$V= 2\iint f(r,\theta) r dr d\theta$$

$$= 2\int_0^{2\pi} \int_0^R \sqrt{A^2 -d^2 -r^2 + 2rd\cos\theta}\ r dr d\theta$$

Here's what Mathematica gives for chosen values of $A,d,and R$. Hopefully this helps.


  • $\begingroup$ Awesome, I just ran this through with a couple of different cases and it seems to handle them all! I found that in the case when A+d<R, a complex number is returned whose real part is equivalent to the volume. Thank you so much, this will help a ton! $\endgroup$
    – J. Kennedy
    Apr 22 '15 at 4:14
  • $\begingroup$ No prob. I just noticed a typo in the code (see image). It should read $Sqrt[A^2-r^2-d^2+2rd \cos\theta]$. I guess I manually put in a $1$ for the $d$ when coding. $\endgroup$
    – suneater
    Apr 22 '15 at 17:19
  • $\begingroup$ Saw that as well. No biggie, I knew what you meant. Unfortunately this integral takes obnoxiously long to evaluate in Mathematica, and I can't get it to evaluate it at all in Matlab so running it a few thousand times is unfortunately out of the question. I thank you anyways though for satisfying my general curiosity! $\endgroup$
    – J. Kennedy
    Apr 22 '15 at 20:48

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.