# Calculating the COM of a Spherical Plot

What is everyone excited for??? More math! Ok, maybe not, but I’ll come back to the electronics projects later (including investigating the Parallax RFID reader, Arduino FIO, and heck, maybe even some more LED fun). In the meantime, let’s get back to math.

What do the volume calculations look like, and how would one go about calculating the center of mass/geometric centroid of a spherical plot? More after the break…

So, using our good buddy, Wolfram Mathworld, we know that the spherical coordinate volume element, basically the volume we will be using when integrating the solid, is equal to:

$dV = \rho^2 \sin(\phi) \, d\rho \, d\phi \, d\theta$

Note that we are going to use the ISO 31-11 convention for our coordinate system, meaning that $\theta$ is the “longitude” and ranges from $0$ to $2\pi$, $\phi$ is the “latitude” and ranges from $0$ to $\pi$, and $\rho$ is the radius at any given point.

Integrating this around a sphere gives us the volume of the sphere:

$V = \int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho^2 \sin(\phi) \, d\rho \, d\phi \, d\theta$

$V = \int_0^{2\pi} \! \int_o^{\pi} \! \frac{1}{3} r^3 \sin(\phi) \, d\phi \, d\theta$

$V = \int_0^{2\pi} \! \frac{2}{3} r^3 \, d\theta$

$V = \frac{4}{3} \pi r^3$

To convert from spherical to Cartesian coordinates, we have to simply use the following:

$x = \rho\sin(\phi)\cos(\theta)$

$y = \rho\sin(\phi)\sin(\theta)$

$z = \rho\cos(\phi)$

So, to solve for the x, y, and z centers of mass, we will need to convert from spherical cooridnates to Cartesian coordinates. We will do this while calculating the function centroid for each axis. The basic formula is:

$COM = \frac{\int \! x f(x) \, dx}{\int \! f(x) \, dx}$

Our $f(x) \, dx$ in this case is the $dV$ from above and so the basic forms for the COM for each of the three axes is:

$COM_{x} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! x \, dV}{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} dV}$

$COM_{y} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! y \, dV}{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} dV}$

$COM_{z} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! z \, dV}{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} dV}$

So, substituting our Cartesian coordinate conversions and our $dV$ from above:

$COM_{x} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho\sin(\phi)\cos(\theta) \rho^2 \sin(\phi) \, d\rho \, d\phi \, d\theta}{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} d\rho \, d\phi \, d\theta}$

$COM_{y} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho\sin(\phi)\sin(\theta) \rho^2 \sin(\phi) \, d\rho \, d\phi \, d\theta}{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} d\rho \, d\phi \, d\theta}$

$COM_{z} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho\cos(\phi) \rho^2 \sin(\phi) \, d\rho \, d\phi \, d\theta}{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} d\rho \, d\phi \, d\theta}$

Simplified:

$COM_{x} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho^3 \sin(\phi)^2 \cos(\theta) \, d\rho \, d\phi \, d\theta}{V}$

$COM_{y} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho^3 \sin(\phi)^2 \sin(\theta) \, d\rho \, d\phi \, d\theta}{V}$

$COM_{z} = \frac{\int_0^{2\pi} \! \int_o^{\pi} \! \int_0^{r} \! \rho^3 \sin(\phi) \cos(\phi) \, d\rho \, d\phi \, d\theta}{V}$

Solving these for a constant (i.e., $r$) leads to:

$COM_{x} = 0$

$COM_{y} = 0$

$COM_{z} = 0$

No big surprise, because, as we would assume, the center of mass for a sphere should be at the origin, $(0,0,0)$.

Now, instead of a perfect circle, let’s try a different shape, say defined by:

$r(\phi,\theta) = 1+\sin(\frac{\theta}{2})\sin(\phi)$

A shape that looks somewhat like a peach and leads to COM values of:

$COM_{x} = \frac{-\frac{784}{225}-\frac{41\pi^2}{128}}{5\pi} \approx -0.423$

$COM_{y} = 0$

$COM_{z} = 0$

Or a spiraling shell:

$r(\phi,\theta) = 1+\theta$

$COM_{x} = \frac{6\pi^2(-3+6\pi+4\pi^2)}{-1+(1+2\pi)^4} \approx 1.165$

$COM_{y} = \frac{6\pi^2(1+\pi)(-5+2\pi+2\pi^2)}{-1+(1+2\pi)^4} \approx -1.833$

$COM_{z} = 0$

Or perhaps something really out there:

$r(\phi,\theta) = 1+\sin(3\theta)\sin(4\phi)+\sin(\theta)\sin(\frac{\phi}{3})$

With COM values of:

$COM_{x} = 0$

$COM_{y} = \frac{32383290752127}{62456794017280} \approx 0.518$

$COM_{z} = -\frac{359881023}{2416474112} \approx -0.149$

This site uses Akismet to reduce spam. Learn how your comment data is processed.