# Non-uniform sampling of N-sphere

Suppose I have a unit $N$-sphere from which I want to draw points at random. To obtain uniformly distributed points I do the usual technique of drawing $N$ random variables $x_i$ from a Gaussian $\mathcal N(0,1)$, then making vectors $\mathbf y$ by

$$y_i = \frac{x_i}{\sqrt{ \sum_j x_j^2}}.$$

However, this isn't quite what I want to do. I would like a sampling technique that has some set of parameters that I can tune (preferably continuously) that lets me smoothly transition between having a non-uniform sample that bunches at the "poles" and one that is uniformly distributed as above. The exact nature of the "bunching" is not hugely important, as long as these two qualitative limiting behaviors exist.

Obviously, I can get bunching at the poles by sampling $N$-dimensional polar angles uniformly on $\theta_i \in [0,2\pi]$, but I'm at a bit of a loss regarding how to continuously move the concentration away from the poles and become uniformly distributed. Is there a sensible way to express the uniformly distributed equal-area sampling as a prior probability on the polar angles $\theta_i$? I can hack it in 2 dimensions quite easily, but in $N$ it's a bit harder.

Any hint at an algorithm would be extremely helpful!

-
Replace $(x_1,x_2,x_3,\ldots,x_n)$ with $(x_1,\lambda x_2,\lambda x_3,\ldots,\lambda x_n)$, then normalize. When $\lambda=1$ you get the uniform distribution on the sphere. When $\lambda=0$ you get all the points at the poles. –  Rahul Jul 7 '14 at 22:52
@Rahul Ah, yes that should work. Obvious in hindsight. –  user162190 Jul 8 '14 at 2:38

Expanding on the comment by Rahul.

You can use weights in your vector prior to normalization. Choose the $x_i$ from a normal distribution just the way you did, but then form a vector

$$(\lambda x_1, x_2, x_3, \dots)$$

and normalize that. For $\lambda=1$ this is obviously your original uniform sampling, but as you increase $\lambda$, the sampled points will bunch at the poles. In the limit $\lambda\to\infty$ you get the poles in $\pm x_1$ direction only. In the other direction, for $\lambda\to0$ you get the equator only.

If you prefer $\lambda\in(0,1]$ as opposed to $\lambda\in[1,\infty)$, you could use the reciprocal meaning and end up with the form Rahul originally suggested, i.e.

$$(x_1, \lambda x_2, \lambda x_3, \dots)$$

Here $\lambda\to0$ represents the poles and $\lambda\to\infty$ the equator, while $\lambda=1$ is again uniform.

Other methods for sphere point picking could possibly be adapted as well, but I think the adaptation is most obvious for the method you are already using.

-