Random point generation on the surface of an n-dimensional torus

I would like to create random points located on the surface of an n-dimensional torus. I found formulas for creating points on the surface of a three-dimensional torus :

x = (c + a * cos(v)) * cos(u) y = (c + a * cos(v)) * sin(u) z = a * sin(v) 

u, v ∈ [0, 2 * pi); c, a> 0.

Now my question is: how to expand these formulas to n dimensions. Any help on this would be greatly appreciated.

+5
source share
3 answers

I assume you can do this recursively. Start with the full orthonormal basis of your vector space, and let the current location take place. At each step, select a point in the plane stretched over the first two coordinate vectors, i.e. Take w1 = cos (t) * v1 + sin (t) * v2. Shift of other basis vectors, i.e. W2 = v3, w3 = v4, .... Also take a step from your current position in the direction of w1, with a radius r1 selected in front. When you have only one base vector left, the current point is a point on the n-dimensional torus of the outermost recursive call.

Please note that although the above can be used to randomly select points, it will not select them evenly. This will probably be much more complicated, and you should definitely ask about the math of this on Math SE or possibly Cross Validated (Statistics SE) to get the math before worrying about its implementation.

+1
source

The n-torus (n is the dimension of the surface of the torus, so the donut or donut is a 2-torus, not a 3-torus) is a smooth mapping of an n-rectangle. One way to get closer to this is to create points on the rectangle and then map them to the torus. Besides the problem of figuring out how to map a rectangle on a torus (I don’t know it aside), the problem arises that the resulting distribution of points on the torus is uneven, even if the distribution of points is equally uniform on the rectangle. But there must be a way to adjust the distribution on the rectangle to make it uniform on the torus.

0
source

Uniform generation of u and v does not necessarily lead to uniform sampling from the surface of the torus. An additional step is needed.

J. F. Williamson, "Random selection of points distributed over curved surfaces," Physics in Medicine & Biology 32 (10), 1987, describes a general method for selecting a uniformly random point on a curved surface. This is an acceptance / rejection method that accepts or rejects each candidate point depending on its stretching coefficient (gradient norm). To use this method, you need to know two things about the surface, namely:

  • g(point) , the norm of the gradient (the "coefficient of expansion") at each point on the surface, and
  • gmax , the maximum value of g for the entire surface.

For a three-dimensional torus with parameterization, which you gmax in your question, g and gmax as follows:

  • g(u, v) = a * (c + cos(v) * a) .
  • gmax = a * (a + c) .

The algorithm for generating a uniform random point on the surface of a three-dimensional torus with torus radius c and tube radius a will be as follows (where RNDEXCRANGE(x,y) returns a number in [x,y) and RNDRANGE(x,y) returns a number in [x,y] ):

 // Maximum stretch factor for torus gmax = a * (a + c) while true u = RNDEXCRANGE(0, pi * 2) v = RNDEXCRANGE(0, pi * 2) x = cos(u)*(c+cos(v)*a) y = sin(u)*(c+cos(v)*a) z = sin(v)*a // Norm of gradient (stretch factor) g = a*abs(c+cos(v)*a) if g >= RNDRANGE(0, gmax) // Accept the point return [x, y, z] end end 

If you have n-dimensional formulas for generating a torus, a similar approach can be used to generate uniform random points on this torus (accept a candidate point if the gradient norm is equal to or exceeds a random number in [0, gmax ), where gmax maximum gradient norm )

0
source

Source: https://habr.com/ru/post/1204424/


All Articles