Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

An Incomplete Post About Sphere Volumes

DZone's Guide to

An Incomplete Post About Sphere Volumes

· Big Data Zone ·
Free Resource

Hortonworks Sandbox for HDP and HDF is your chance to get started on learning, developing, testing and trying out new features. Each download comes preconfigured with interactive tutorials, sample data and developments from the Apache community.

This is an incomplete blog post. Maybe you can help finish it.

One of the formulas I’ve looked up the most is the volume of a ball in n dimensions. I needed it often enough to be aware of it, but not often enough to remember it. Here’s the formula:

\frac{\pi^{\frac{n}{2}}}{\Gamma\left(\frac{n}{2} + 1\right)}r^n

The factor of rn is no surprise: of course the volume as a function of radius has to be proportional to rn. So we can make the formula a little simpler by just remembering the formula for the volume of a unit ball.

Next, we can make the formula a simpler still by using factorials instead of the gamma function. If n is a non-negative integer, n! = Γ(n+1). We can use that to define factorial for non-integers. Then the volume of a unit ball is

 \frac{\pi^{\frac{n}{2}}}{\frac{n}{2}!}

That’s easier to remember.

It’s also curious. The nth term in the series for ex is xn/n!, so the volumes of unit balls look like series for eπ except compressed, with each index n cut in half. The volumes are not the coefficients in the series for ex, but could they be the coefficients in the series for another familiar function? To find out, let’s stick back in the factor of rn and sum.

\sum_{n=0}^\infty \frac{\pi^{\frac{n}{2}}}{\frac{n}{2}!} \,r^n

This is the sum of the volumes of balls of radius r in all dimensions. That doesn’t make sense by itself, but you could also think of this as the generating function for the volumes ofunit balls. So can we find a closed-form expression for the generating function? Yes:

\sum_{n=0}^\infty \frac{\pi^{\frac{n}{2}}}{\frac{n}{2}!} \,r^n = \sqrt{\pi} r \exp(\pi r^2) (\mbox{erf}(\sqrt{\pi} r) + 1)

If you work with probability, you probably find Φ more familiar than the error function (see notes relating these) and find exp(x2/2) more familiar than exp(x2). So you could rewrite the generating function as f(√(2π)r) where

f(x) = \sqrt{2} x\exp(x^2/2) \Phi(x)

That looks familiar, but I don’t know what to do with it.

I warned you this would an incomplete post. I feel like there’s an interesting connection to be made, but I’m not quite there. Any suggestions?

Hortonworks Community Connection (HCC) is an online collaboration destination for developers, DevOps, customers and partners to get answers to questions, collaborate on technical articles and share code examples from GitHub.  Join the discussion.

Topics:

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}