# Test regularity of Simplex

A simplex is regular if its all edges have the same length.

How to test in Mathematica whether a Simplex is regular or not, without checking all the edges manually? I'm not really familiar with loops in Mathematica. I also can't find in the documentation how to access the vertices of a Simplex.

• Does (Equal @@ EuclideanDistance @@@ Subsets[#, {2}]) & @@ Simplex[{{0, 1, 0}, {1, 0, 0}, {0, 0, 1}, {1, 1, 1}}] count as "checking all the edges manually"? Apr 8 '17 at 0:42
• @J.M. No, it is okay, I can make a function from this. If you repost it as an answer, I accept it. Apr 8 '17 at 0:48

As I mentioned in my comment, you can use Subsets[] to enumerate the edges of your simplex:

regularSimplexQ[Simplex[vertices_]] :=
MatrixQ[vertices] && Subtract @@ Dimensions[vertices] == 1 &&
Equal @@ EuclideanDistance @@@ Subsets[vertices, {2}];
regularSimplexQ[_] := False


Try it out:

regularSimplexQ[Simplex[{{0, 0, 1}, {1, 0, 0}, {1, 0, 1}, {1, 1, 1}}]]
False

regularSimplexQ[Simplex[{{0, 1, 0}, {1, 0, 0}, {0, 0, 1}, {1, 1, 1}}]]
True

ClearAll[regSimplexQ]
regSimplexQ = Equal @@ PropertyValue[{MeshRegion[#, Simplex[{1, 2, 3, 4}]] & @@ #, 1},
MeshCellMeasure] &;

regSimplexQ@Simplex[{{0, 1, 0}, {1, 0, 0}, {0, 0, 1}, {1, 1, 1}}]


True

regSimplexQ@Simplex[{{0, 0, 1}, {1, 0, 0}, {1, 0, 1}, {1, 1, 1}}]


False