1
$\begingroup$

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.

$\endgroup$
2
  • 3
    $\begingroup$ 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"? $\endgroup$ Commented Apr 8, 2017 at 0:42
  • $\begingroup$ @J.M. No, it is okay, I can make a function from this. If you repost it as an answer, I accept it. $\endgroup$ Commented Apr 8, 2017 at 0:48

2 Answers 2

2
$\begingroup$

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 
$\endgroup$
1
$\begingroup$
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

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.