It has been explained here why sampling from n-sphere is not achievable with naive parametrization. And it explains how to correct it for 3 dimensions. Can somebody please guide me what is the correct method for uniformly sampling in n dimensions using the spherical coordinates? i.e. \begin{align} &x_1 = r \cos(\phi_1) \,\\ &x_2 = r \sin(\phi_1) \cos(\phi_2) \,\\ &x_3 = r \sin(\phi_1) \sin(\phi_2) \cos(\phi_3) \,\\ &{}\,\,\,\vdots\\ &x_{n-1} = r \sin(\phi_1) \cdots \sin(\phi_{n-2}) \cos(\phi_{n-1}) \,\\ &x_n = r \sin(\phi_1) \cdots \sin(\phi_{n-2}) \sin(\phi_{n-1}) \,. \end{align}
-
1$\begingroup$ Why do you want to do this via spherical coordinates instead of the more conventional way, as mentioned in your second link? $\endgroup$– cardinalNov 23, 2013 at 19:03
-
$\begingroup$ @cardinal Because actually I am not after sampling now(I will use it later when I need Monte Carlo methods). Right now I am dealing with the case of parametrization of a $n-1$-sphere to be able to assign probability to points on it. A uniform sampling method based on this parametrisation will provide me with one way to do so, right? $\endgroup$– CupitorNov 23, 2013 at 19:10
-
$\begingroup$ The hypersphere is my parameter space. $\endgroup$– CupitorNov 23, 2013 at 19:14
-
$\begingroup$ mathworld.wolfram.com/HyperspherePointPicking.html $\endgroup$– innisfreeMay 26, 2021 at 1:57