1
$\begingroup$

Eric Weisstein's Sphere Point Picking points out that sampling uniformly from each angle $\phi$ and $\theta$ in spherical coordinates does not sample from the uniform sphere because it clusters near the poles. I am interested in which distribution over the angles does sample uniformly over the area element.

For the spherical case, he notes that the random variables $\phi$ and $\theta$ that do correspond to sampling from the uniform sphere are:

$\theta = 2\pi u \\ \phi = \cos^{-1}(2v -1)$

where $u$ and $v$ are random variables uniformly distributed over [0, 1].

I would like to know how this extends to n-dimensional hyperspheres. Is there a similar expression for the distribution of the angles $\boldsymbol{\theta}$ when sampling from a uniform hypersphere?

Very grateful for any help!

(I'm aware that there are simpler ways to sample from the unit hypersphere such as this. I'm specifically interested in the probability density function of the angles.)

$\endgroup$
  • 2
    $\begingroup$ It is not clear to me what your "angles" are for $S^n$ for $n>2$. Can you be more specific, relating your angles to some other standard parameterization, say that by $(x_1,\ldots x_n): \sum x_i^2=1$? $\endgroup$ – kimchi lover Aug 13 at 2:10
  • $\begingroup$ @kimchilover - en.wikipedia.org/wiki/N-sphere#Spherical_coordinates $\endgroup$ – mr_e_man Aug 13 at 3:11
  • $\begingroup$ @mr_e_man Oh, in that case don't the absolute values of the sines of the angles have Beta distributions? $\endgroup$ – kimchi lover Aug 13 at 3:56
0
$\begingroup$

If you're using hyperspherical coordinates, the area element of the $n$-sphere can be written $$ \sin^{n-1}(\phi_1)\sin^{n-2}(\phi_2)\ldots \sin(\phi_{n-1})d\phi_1\ldots d\phi_n$$ where $\phi_1,\ldots\phi_{n-1}$ range from $0$ to $\pi$ and $\phi_n$ ranges from $0$ to $2\pi.$

So this gives you the pdf's of the angles right there: $\phi_n$ is uniform, $\phi_{n-1}$ has a pdf proportional to $\sin(\phi_{n-1}),$ etc.

I don't see a particularly nice way to express the inverse CDF though, which is what you need to get the expression in terms of a uniform. For instance, the way it works for $\phi_{n-1}$ is that $$ F(\phi_{n-1}) = \frac{\int_0^{\phi_{n-1}}\sin(\phi_{n-1})d\phi_{n-1}}{\int_0^\pi \sin(\phi_{n-1})d\phi_{n-1}} = \frac{1}{2}(1-\cos(\phi_{n-1}))$$ which has inverse function $$F^{-1}(u) = \arccos(1-2u) $$ which agrees with what you were told for the polar angle in the three dimensional case.

But for $\phi_{n-2}$ we have $$ F(\phi_{n-2}) = \frac{\int_0^{\phi_{n-2}}\sin^2(\phi_{n-2})d\phi_{n-2}}{\int_0^\pi \sin(\phi_{n-2})d\phi_{n-2}} = \frac{1}{\pi}(\phi_{n-2}-\frac{1}{2}\sin(2\phi_{n-2}))$$ which doesn't have any nice inverse in closed form I'm aware of. That said, the CDFs all have closed forms an it is easy enough to invert them numerically.

$\endgroup$
  • $\begingroup$ Thank you! I think this was exactly what I needed. I'll see if I can get this to work for me! $\endgroup$ – safdisdfkj Aug 14 at 9:31

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.