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$
    – J. M.'s torpor
    Apr 8 '17 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$
    – plasmacel
    Apr 8 '17 at 0:48
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$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.