2
$\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$ Commented Aug 31, 2018 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$
    – MWB
    Commented Aug 31, 2018 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$ Commented Sep 1, 2018 at 1:58

1 Answer 1

6
$\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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .