0
$\begingroup$

There is a simple algorithm to pick a random point ON an $n$-dimensional hypersphere.

Is there one to sample a point from inside it? (Sampling points from a hypercube and rejecting them if they are not inside the hypersphere would scale extremely poorly with $n$, as the vast majority of points would be rejected)

$\endgroup$
3
  • $\begingroup$ Mark Meckes's accepted answer to that question answers this one too: take a random point on the $n+1$-dimensional hypersphere and drop two coordinates. $\endgroup$ – Nate Eldredge Aug 31 '18 at 22:23
  • $\begingroup$ @NateEldredge $n+2$ perhaps, since we want to keep $n$ numbers? It's not super-obvious that this will be uniformly distributed though. $\endgroup$ – bobcat Aug 31 '18 at 23:25
  • $\begingroup$ I think $n+1$ is correct; remember that the $n+1$-hypersphere is the unit sphere of $\mathbb{R}^{n+2}$. It may not be super-obvious but I think it's a fairly straightforward calculus exercise. $\endgroup$ – Nate Eldredge Sep 1 '18 at 1:58
5
$\begingroup$

Choose a uniform point $X$ on the unit hypersphere, then multiply it by $U^{1/n}$ where $U \sim U(0,1)$ is independent of $X$.

$\endgroup$
0

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.