4
$\begingroup$

Suppose I have the following scenario:

enter image description here

And I am aware of an algorithm to draw uniformly from (in this case) the 2-sphere. Does this same algorithm readily extend to the situation where I randomly take a "cut/slice" (shown in red above) and what points uniformly over this circle?

Further, suppose now that I have a uniform random sampling algorithm over an arbitrary Riemannian manifold. Would the same principles necessarily apply?

$\endgroup$
10
  • $\begingroup$ What principles are you referring to?? Indeed, this specific example involves one Riemannian manifold (the 2-sphere), but the disk itself is not. (It's a manifold-with-boundary and the two of them are embedded in a larger space.) $\endgroup$
    – whuber
    Commented Jun 10, 2023 at 17:39
  • $\begingroup$ Oh ok let me clarify. Evidently the sphere is a Riemannian manifold so I am wondering if whatever is answered here can naturally extend to any Riemannian manifold. Where my question is as above. Stated again briefly here, "If I have the above 2-sphere, that has a method to uniformly sample over its surface (of which there are many). Can that method be easily extended to uniformly sample (or obtain uniform samples) over any given slice/disk taken from this 2-sphere". I hope that provides a little more clarification? $\endgroup$ Commented Jun 10, 2023 at 17:44
  • $\begingroup$ There seems to be a contradiction here. The slice will be a circle, but you refer to it as a disk; and if the slice is a disk, then do you mean the 3-ball instead of the 2-sphere? $\endgroup$
    – whuber
    Commented Jun 10, 2023 at 17:46
  • $\begingroup$ Yes you are correct, I misspoke. In my head I meant the 2-sphere, and the "circle". This is what I had in mind. But will the implications necessarily be different when considering 3-ball --> disk? As far as I envision the question is about uniform sampling over some $D$ dimensional Riemannian structure, and its implications for a $D-1$ dimensional structure (as it lies on the same geometry). $\endgroup$ Commented Jun 10, 2023 at 18:04
  • 1
    $\begingroup$ The sphere, btw, is special: it's easy to define a transformation from it to any circle that preserves uniformity of distribution (just make the common axis of the sphere and circle the origin of latitude, longitude coordinates: the map identifies the circle with the meridians). But such a transformation won't exist for an arbitrary manifold. $\endgroup$
    – whuber
    Commented Jun 10, 2023 at 19:40

3 Answers 3

3
$\begingroup$

Let's restate the originally intended problem: we have a uniform sample of D-1 sphere. How to convert this into uniform sampling of D-2 sphere? For instance, if we have a sample on a surface of a sphere, how to convert it to a uniform sample on a circle?

The idea is to define that given circle on a sphere with the axis that goes from the center of the sphere through a center of a circle. This axis would be z-axis of spherical coordinate system, and make the given circle one of latitudes:

enter image description here.

Now, if you observe only the angle $\varphi$ (azimuth angle or longitude) of the uniformly random points on a sphere, this will give you a uniform sample of points on a circle, because a point on a circle can easily be located by that angle.

Now, for a general D-1 sphere, we have the same approach. We define a circle on the sphere by the z-axis. After that azimuth angle can be calculated easily by projecting the points on sphere to the hyperplane that is orthogonal to this z-axis. Then you calculate the cosine (azimuth angle) to any fixed vector on that hyperplane that gives through the center of the D-sphere.

A disk can be sampled from a ball in a similar way. The difference is that for a disk we need two spherical coordinates: an azimuth angle and the distance to the point from the center of a disk. We then re-scale the distance so that it corresponds to the distance on the given disk.

Examples for a circle

Here's an example. I sampled 100 points on a sphere, shown in blue, using Marsaglia's algorithm. Next, I converted the cartesian coordinates into spherical coordinates. Assuming that $x_1$ is my z-axis, I proceeded replacing $\varphi_1$ with a given angle $\pi/6$ that defines the circle. The resulting points are shown in black, and lie on a circle, as expected.

enter image description here

Here's an example in 4-dimensions. Since I can't plot 4 dimensional objects, only the projected points will be shown. So, I sampled from 3-sphere in 4 dimensions. Then proceeded applying the same algorithm to project the points onto a 2-sphere in 3 dimensions. The result is shown below. As you can see the sphere is, of course, smaller than the unit sphere, but the points are uniformly distributed on it.

enter image description here

$\endgroup$
1
$\begingroup$

Is it possible to uniformly draw points over a D−2 sphere, given that one has an algorithm to draw over the D−1 sphere in D-dimensional space?

You can consider an n-sphere as a sum of (n-1)-spheres.. An n-sphere can be constructed by stacking scaled (n-1)-spheres.

n+1 ball as sum of n-balls

And you can turn around that process.

The n-sphere has n+1 coordinates and if you take n of the coordinates and scale them to get the appropriate length of the desired radius of the sphere, then you have the n coordinates of a n-1 sphere.

Further, suppose now that I have a uniform random sampling algorithm over an arbitrary Riemannian manifold. Would the same principles necessarily apply?

The case of spheres has a simple solution. But for other surfaces/spaces you will need to take another approach to get the slice (like rejection sampling and taking only points in a small range of distance to a plane). Also the slice will not have a uniform distribution.

E.g take a slice of carambola. If you trace that slice with a measuring tape and compute for each amount of length that you go around the amount of surface that you have, then there will be a difference, the points have more surface. The same is true when you cut a cucumber at an angle (and this you could model like cutting an ellipsoid at an angle).

So a D-2 dimensional hyperspace slice from a uniform distribution on a D-1 hyperspace may not itself have a uniform distribution. If your question is about "how to resolve this?" or "how to get a slice with a uniform distribution?" then you could apply the rejection sampling method that is an answer to the question How to sample uniformly from the surface of a hyper-ellipsoid (constant Mahalanobis distance)?

$\endgroup$
1
0
$\begingroup$

$\newcommand{\v}{\boldsymbol v} \newcommand{\w}{\boldsymbol w}$

Given a unit vector $\v_1$ and a positive length $c<1$, you can sample the points $\v$ in $R^d$ with $\v\cdot \v=1$ and $\v\cdot v_1=c$ as follows:

  1. Choose vectors $\v_2,\dots \v_d$ which are mutually orthogonal and orthogonal to $\v_1$.

  2. Generate independent standard normals $z_2,\dots z_d$.

  3. Let $\w=\sum_{i=2}^d z_i \v_i/|\v_i|$.

  4. Let $$\v = c \v_1 + \sqrt{1-c^2}\frac{\w}{|\w|}$$

Now $\v$ has the right distribution. The key is that the joint distribution of $z$’s is proportional to $\exp(-\sum z_i^2/2)$, so any two possible $\v$’s at the same distance from $cv_1$ will be equally probable.

$\endgroup$
1
  • $\begingroup$ The question isn't how to sample (that has been answered in several other threads here on CV): it concerns how to adapt a specific algorithm for obtaining that sample. $\endgroup$
    – whuber
    Commented Dec 23, 2023 at 21:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.