Wolfram Research

Function Repository Resource:

CenteredSimplex

Source Notebook

Return an origin-centered simplex where the square of all edge lengths is 2

Contributed by: Ed Pegg Jr

ResourceFunction["CenteredSimplex"][dim]

returns an origin-centered simplex with dimension dim.

Examples

Basic Examples (3) 

A simplex in 3D, otherwise known as a regular tetrahedron:

In[1]:=
tet = ResourceFunction["CenteredSimplex"][3]
Out[1]=

The center is the origin and all edge-lengths are :

In[2]:=
{Mean[tet], EuclideanDistance @@ # & /@ Subsets[tet, {2}]}
Out[2]=

Show the simplex:

In[3]:=
Graphics3D[Simplex[tet]]
Out[3]=

Properties and Relations (2) 

The last vertex of a k-dimensional CenteredSimplex output is a vector of length k with each coordinate having value :

In[4]:=
Table[n -> Last[ResourceFunction["CenteredSimplex"][n]], {n, 2, 7}]
Out[4]=

The other k vertices are permutations of one another:

In[5]:=
Grid[Table[
  Prepend[Most[ResourceFunction["CenteredSimplex"][n]], n], {n, 2, 4}], Frame -> All]
Out[5]=

Select two random points in 3D space:

In[6]:=
twopoints = RandomInteger[{-9, 9}, {2, 3}]
Out[6]=

We can use the centered simplex system when converting the points to barycentric coordinates, the latter of which can be done using the resource function BarycentricCoordinates:

In[7]:=
barypoints = ResourceFunction["BarycentricCoordinates"][
    ResourceFunction["CenteredSimplex"][3], #] & /@ twopoints
Out[7]=

When a regular simplex with edge-lengths is used for barycentric coordinates, the Euclidean distance is preserved:

In[8]:=
{EuclideanDistance @@ twopoints, EuclideanDistance @@ barypoints}
Out[8]=

Neat Examples (2) 

We can append to each vertex to get a square matrix:

In[9]:=
H = Append[#, 1/Sqrt[8 + 1]] & /@ ResourceFunction["CenteredSimplex"][8];
MatrixForm[H]
Out[9]=

This matrix has determinant 1 as well as mutually orthogonal rows and columns:

In[10]:=
{Det[H], Dot @@ RandomSample[H, 2]}
Out[10]=

Resource History

Related Resources

License Information