Projecting points from 4d space to 3d space in Mathematica

Suppose we have a set of points with the restriction that for each point all coordinates are non-negative, and the sum of the coordinates is 1. This limits the points lying in the 3-dimensional simplex, so it makes sense to try translating it back into 3-dimensional space for renderings.

The map I'm looking for will require extreme points (1,0,0,0), (0,1,0,0), (0,0,1,0) and (0,0,0, 1) to the vertices a "well-positioned" regular tetrahedron. In particular, the center of the tetrahedron will be at the origin, one vertex will lie on the z axis, one face parallel to the x, y plane, and one edge parallel to the x axis.

Here's a code that does a similar thing for points in three dimensions, but it doesn't seem obvious how to increase it to 4. Basically I am looking for the 4th equivalent of tosimplex functions (which takes 4 dimensions in 3) and it is inverse from simple

  A = Sqrt [2/3] {Cos [#], Sin [#], Sqrt [1/2]} & / @ 
     Table [Pi / 2 + 2 Pi / 3 + 2 k Pi / 3, {k, 0, 2}] // Transpose;
 B = Inverse [A];
 tosimplex [{x_, y_, z_}]: = Most [A. {x, y, z}];
 fromsimplex [{u_, v_}]: = B. {u, v, Sqrt [1/3]};

 (* checks *)
 extreme = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};
 Graphics [Polygon [tosimplex / @ extreme]]
 fromsimplex [tosimplex [#]] == # & / @ extreme 

Answer:

direct reformulation of the deinst answer in terms of matrices gives the following. (1 / sqrt [4] appears as the 4th coordinate, because this is the distance to the simplex center)

  A = Transpose [{{- (1/2), - (1 / (2 Sqrt [3])), - (1 / (2 Sqrt [6])), 
      1 / Sqrt [4]}, {1/2, - (1 / (2 Sqrt [3])), - (1 / (2 Sqrt [6])), 
      1 / Sqrt [4]}, {0, - (1 / (2 Sqrt [3])) + Sqrt [3] / 2, - (1 / (2 Sqrt [6])), 
      1 / Sqrt [4]}, {0, 0, Sqrt [2/3] - 1 / (2 Sqrt [6]), 1 / Sqrt [4]}}];
 B = Inverse [A];
 tosimplex [{x_, y_, z_, w_}]: = Most [A. {x, y, z, w}];
 fromsimplex [{t_, u_, v_}]: = B. {t, u, v, 1 / Sqrt [4]};

 (* Checks *)
 extreme = Table [Array [Boole [# == i] &, 4], {i, 1, 4}];
 Graphics3D [Sphere [tosimplex [#], .1] & / @ extreme]
 fromsimplex [tosimplex [#]] == # & / @ extreme
+4
source share
2 answers

Do you want to

(1,0,0,0) -> (0,0,0) (0,1,0,0) -> (1,0,0) (0,0,1,0) -> (1/2,sqrt(3)/2,0) (0,0,0,1) -> (1/2,sqrt(3)/6,sqrt(6)/3)) 

And this is a linear transformation, so you transform

  (x,y,z,w) - > (y + 1/2 * (z + w), sqrt(3) * (z / 2 + w / 6), sqrt(6) * w / 3) 

Change You want the center at the origin - just subtract the average from four points. Unfortunately

 (1/2, sqrt(3)/6, sqrt(6) / 12) 
+7
source

One possibility:

  • Generate four (non-orthogonal) 3-vectors, \vec{v}_i from the center of the tetrahedron to each vertex.
  • For each four positions x = (x_1 .. x_4) form the vector sum \Sum_i x_i*\vec{v}_i .

Of course, this mapping is not unique in the general case, but you claim that the sum x_i to 1 limits things.

+1
source

All Articles