SIMPLEX_COORDINATES
Coordinates of Regular Simplex in M Dimensions


SIMPLEX_COORDINATES is a Python library which computes the Cartesian coordinates of the vertices of a regular simplex in M dimensions.

Note that the unit simplex, formed by the origin and the M unit coordinate axes, is not a regular simplex, because some sides have length 1 while other sides have length sqrt(2).

There is a straightforward but tedious method for computing these coordinates, coded in SIMPLEX_COORDINATES1, based on the idea of selecting the first coordinate to be (1,0,0,...0), and noting that the dot product with vectors 2 through N+1 must be -1/N, which means the first row and first column of the coordinate matrix are done. We can then move to entry (2,2), assume the coordinates below it are 0, and set its value by requiring that the sum of the squares of the (2,1) and (2,2) entries must be 1. Setting the (2,2) entry then allows us to determine the rest of row 2 by the same dot product criterion, and we proceed in this way til we have completed the matrix.

A simpler algorithm, in SIMPLEX_COORDINATES2, notes that the identity matrix will almost work for the first N vertices. Choose the last vertex by assuming all its entries are equal to some constant A, and that its distance from any other vertex must be sqrt ( 2 ). This determines that (A-1)^2 + (N-1)*A^2 = 2, from which we get the value of A as (1-sqrt(N+1))/N. To clean things up, we compute the centroid C of these vertices, and recenter the simplex around the origin. Then we determine the distance S of one vertex to the origin, and rescale so that this becomes 1. The coding is simpler, and there is much less chance for the accumulation of numerical error. Plus I thought of this one myself.

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Languages:

SIMPLEX_COORDINATES is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and a Python version.

Related Data and Programs:

SIMPLEX_GRID, a Python library which generates a regular grid of points over the interior of an arbitrary simplex in M dimensions.

SIMPLEX_MONTE_CARLO, a Python library which uses the Monte Carlo method to estimate integrals over the interior of the unit simplex in M dimensions.

Source Code:

Examples and Tests:

You can go up one level to the Python source codes.


Last revised on 28 June 2015.