列出四面体的所有有趣部分

发布于 2024-09-24 02:38:59 字数 3511 浏览 2 评论 0原文

答案更新,12/22: 使用 Peter Shor 的观察,存在同态在立方体上的不同部分和对象排列之间,通过将一组立方体对称性表示为 SymmetricGroup[8] 的子群并使用 GroupElements/Permute 列出所有此类排列,使用 Mathematica 的 SAT 求解器查找质心分配,选择具有不同奇异值的点集值,更多细节和完整代码此处给出

问题

一个有趣的 2D 截面是一个穿过常规 3D 中心的平面 simplex 和其他 2 个点,每个点都是某些非空顶点子集的质心。它由两个顶点子集定义。例如,{{1},{1,2}} 给出由 3 个点定义的平面:四面体中心、第一个顶点以及第一个和第二个顶点的平均值。

一组有趣的部分是其中没有两个部分在顶点重新标记下定义同一平面的集合。例如,集合 {{{1},{2}},{{3},{4}}} 并不有趣。有没有一种有效的方法来找到一组有趣的有趣部分?我需要一些可以推广到 7D 单纯形的 3D 部分的类似问题的东西,并且可以在一夜之间完成。

我尝试的方法如下。一个问题是,如果你忽略几何图形,一些等效的部分将被保留,所以我得到 10 个部分而不是 3 个。一个更大的问题是我使用了蛮力,它肯定无法缩放并且(需要 10^17 7D 单纯形比较)


(来源:yaroslavvb.com

这是Mathematica 代码来生成上面的图片。

entropy[vec_] := Total[Table[p Log[p], {p, vec}]];
hadamard = KroneckerProduct @@ Table[{{1, 1}, {1, -1}}, {2}];
(* rows of hadamard matrix give simplex vertex coordinates *)

vertices = hadamard;
invHad = Inverse[hadamard];
m = {m1, m2, m3, m4};
vs = Range[4];

(* take a set of vertex averages, generate all combinations arising \
from labeling of vertices *)
vertexPermutations[set_] := (
   newSets = set /. Thread[vs -> #] & /@ Permutations[vs];
   Map[Sort, newSets, {2}]
   );
(* anchors used to define a section plane *)

sectionAnchors = Subsets[{1, 2, 3, 4}, {1, 3}];
(* all sets of anchor combinations with centroid anchor always \
included *)
anchorSets = Subsets[sectionAnchors, {2}];
anchorSets = Prepend[#, {1, 2, 3, 4}] & /@ anchorSets;
anchorSets = Map[Sort, anchorSets, {2}];
setEquivalent[set1_, set2_] := MemberQ[vertexPermutations[set1], set2];
equivalenceMatrix = 
  Table[Boole[setEquivalent[set1, set2]], {set1, anchorSets}, {set2, 
    anchorSets}];
Needs["GraphUtilities`"];
(* Representatives of "vertex-relabeling" equivalence classes of \
ancher sets *)
reps = First /@ StrongComponents[equivalenceMatrix];

average[verts_] := Total[vertices[[#]] & /@ verts]/Length[verts];
makeSection2D[vars_, {p0_, p1_, p2_}] := Module[{},
   v1 = p1 - p0 // Normalize;
   v2 = p2 - p0;
   v2 = v2 - (v1.v2) v1 // Normalize;
   Thread[vars -> (p0 + v1 x + v2 y)]
   ];

plotSection2D[f_, pointset_] := (
   simplex = 
    Graphics3D[{Yellow, Opacity[.2], 
      GraphicsComplex[Transpose@Rest@hadamard, 
       Polygon[Subsets[{1, 2, 3, 4}, {3}]]]}];
   anchors = average /@ pointset;
   section = makeSection2D[m, anchors];
   rf = Function @@ ({{x, y, z, u, v}, 
       And @@ Thread[invHad.{1, x, y, z} > 0]});
   mf = Function @@ {{p1, p2, p3, x, y}, f[invHad.m /. section]};
   sectionPlot = 
    ParametricPlot3D @@ {Rest[m] /. section, {x, -3, 3}, {y, -3, 3}, 
      RegionFunction -> rf, MeshFunctions -> {mf}};
   anchorPlot = Graphics3D[Sphere[Rest[#], .05] & /@ anchors];
   Show[simplex, sectionPlot, anchorPlot]
   );
plots = Table[
   plotSection2D[entropy, anchorSets[[rep]]], {rep, reps}];
GraphicsGrid[Partition[plots, 3]]

Answer update, 12/22:
Using Peter Shor's observation that there's a homomorphism between distinct sections and permutations of objects on the cube, list all such permutations by representing a group of cube symmetries as a subgroup of SymmetricGroup[8] and using GroupElements/Permute, find centroid assignments using Mathematica's SAT solver, select point sets with distinct singular values, few more details and complete code given here

Question

An interesting 2D section is a plane that goes through the center of a regular 3D simplex and 2 other points each of which is a centroid of some non-empty subset of vertices. It is defined by two subsets of vertices. For instance {{1},{1,2}} gives a plane defined by 3 points -- center of the tetrahedron, first vertex, and average of first and second vertices.

An interesting set of sections is a set in which no two sections define the same plane under vertex relabeling. For instance, set {{{1},{2}},{{3},{4}}} is not interesting. Is there an efficient approach to finding an interesting set of interesting sections? I need something that could generalize to an analogous problem for 3D sections of 7D simplex, and finish overnight.

My attempted approach is below. One problem is that if you ignore geometry, some equivalent sections are going to be retained, so I get 10 sections instead of 3. A bigger problem is that I used brute-force and it definitely doesn't scale and (needs 10^17 comparisons for 7D simplex)


(source: yaroslavvb.com)

Here's the Mathematica code to generate picture above.

entropy[vec_] := Total[Table[p Log[p], {p, vec}]];
hadamard = KroneckerProduct @@ Table[{{1, 1}, {1, -1}}, {2}];
(* rows of hadamard matrix give simplex vertex coordinates *)

vertices = hadamard;
invHad = Inverse[hadamard];
m = {m1, m2, m3, m4};
vs = Range[4];

(* take a set of vertex averages, generate all combinations arising \
from labeling of vertices *)
vertexPermutations[set_] := (
   newSets = set /. Thread[vs -> #] & /@ Permutations[vs];
   Map[Sort, newSets, {2}]
   );
(* anchors used to define a section plane *)

sectionAnchors = Subsets[{1, 2, 3, 4}, {1, 3}];
(* all sets of anchor combinations with centroid anchor always \
included *)
anchorSets = Subsets[sectionAnchors, {2}];
anchorSets = Prepend[#, {1, 2, 3, 4}] & /@ anchorSets;
anchorSets = Map[Sort, anchorSets, {2}];
setEquivalent[set1_, set2_] := MemberQ[vertexPermutations[set1], set2];
equivalenceMatrix = 
  Table[Boole[setEquivalent[set1, set2]], {set1, anchorSets}, {set2, 
    anchorSets}];
Needs["GraphUtilities`"];
(* Representatives of "vertex-relabeling" equivalence classes of \
ancher sets *)
reps = First /@ StrongComponents[equivalenceMatrix];

average[verts_] := Total[vertices[[#]] & /@ verts]/Length[verts];
makeSection2D[vars_, {p0_, p1_, p2_}] := Module[{},
   v1 = p1 - p0 // Normalize;
   v2 = p2 - p0;
   v2 = v2 - (v1.v2) v1 // Normalize;
   Thread[vars -> (p0 + v1 x + v2 y)]
   ];

plotSection2D[f_, pointset_] := (
   simplex = 
    Graphics3D[{Yellow, Opacity[.2], 
      GraphicsComplex[Transpose@Rest@hadamard, 
       Polygon[Subsets[{1, 2, 3, 4}, {3}]]]}];
   anchors = average /@ pointset;
   section = makeSection2D[m, anchors];
   rf = Function @@ ({{x, y, z, u, v}, 
       And @@ Thread[invHad.{1, x, y, z} > 0]});
   mf = Function @@ {{p1, p2, p3, x, y}, f[invHad.m /. section]};
   sectionPlot = 
    ParametricPlot3D @@ {Rest[m] /. section, {x, -3, 3}, {y, -3, 3}, 
      RegionFunction -> rf, MeshFunctions -> {mf}};
   anchorPlot = Graphics3D[Sphere[Rest[#], .05] & /@ anchors];
   Show[simplex, sectionPlot, anchorPlot]
   );
plots = Table[
   plotSection2D[entropy, anchorSets[[rep]]], {rep, reps}];
GraphicsGrid[Partition[plots, 3]]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

薄情伤 2024-10-01 02:38:59

概括地说,正确的编程解决方案是:

  • 观察中心以投影对的形式出现——因此识别并仅保留位于一组中心的一个或另一个半球形覆盖物中的一半中心。配对是彼此互补的。示例规则:包含顶点 1 的所有子集,以及“赤道”上的子集,包含顶点 2 的子集,以及该集合的“赤道”上包含顶点 3 的子集,依此类推,递归地保持边界一半与最小索引相邻顶点。
  • 观察到对于每个子单纯形,子单纯形要么与顶点 1 相邻,要么距单纯形距离 1。 (原因:四面体中的每个新顶点都附加到四面体的每个先前顶点 - 因此每个子单纯形要么入射在顶点 1 上,要么顶点 1 连接到单纯形中的每个顶点。)因此,每个子单纯形中只有两个总体一种次单纯形(相对于指定的顶点)。 (我们可以用只保留每个射影对中较小成员的决定来替换这个观察结果,但是标记顶点的规则会更加复杂。)
  • 四面体在顶点标签排列下是完全对称的。因此,任何“有趣的部分”等价于仅包含顶点的前导部分的另一个部分 - 即可以在某些 n 的顶点 Range[1,n] 之间进行识别。

  • 收集以上内容,我们发现存在从有趣部分到一组图的满射。对于每个图,我们必须枚举一致的顶点成员资格(稍后描述)。除一个顶点外,图的顶点都是成对的

    • 该对包含给定基数的所有中心(给定维度的所有子单纯形)。
    • 该对中的一个成员包含入射在顶点 1 上的中心。
    • 该对中的另一个成员包含不与顶点 1 重合的中心。
    • 特殊顶点是包含所有顶点的中心或其射影对(“空中心”)。
    • 如果图包含一对中的任何成员,则它必须(至少)包含包含与 1 相关的中心的成员(或者可以重新标记顶点以实现此目的)。
  • 图的边缘被加权。权重是两个中心共享的顶点数。基于每端中心的基数以及两个顶点是否都是第一成员、都是第二成员或者都是其中一个,对权重有限制。 (例如,“其中一个”不能共享顶点 1。)
  • 图是顶点集上的完整子图,包含特殊顶点。例如,对于四面体,图是上面确定的一组顶点上的 K_{3},其中一个顶点是特殊顶点,并且具有边权重。
  • 部分是在每条边末端的中心一致应用标签的图(即,一致地标记以尊重由边的权重指示的共享顶点的数量,并且一组图顶点中的每个子集包含顶点 1) 。因此,给定的图可以表示多个部分(通过不同的标签)。 (选项并不像听起来那么多,很快就会有意义。)
  • 如果由中心坐标组成的矩阵具有零行列式,则该部分就没有意义。

在具有四个顶点的三个维度的情况下,我们得到以下集合(我们使用短投影对,因为此示例中有足够的可见性,不需要更简单的顶点标记拒绝规则):
0:射影对 {1,2,3,4}
1:{1}
1':{2},{3},{4}
2:{1,2},{1,3},{1,4}
2':投影对 2(因此省略)
3:到 1' 的投影对(因此省略)
3':射影对 1(因此省略)

标签约束:
{0->x,x}
{0->x',x}
{1->1,1} -- 不允许:中心不包含两次
{1->1',0}
{1->2,1}
{2->2,1}
这些图顶点不可能有其他权重。

图是 0 上的 K_{3} 事件,以下图符合图选择规则:
答:{0->1,1},{0->1',1},{1->1',0}
B:{0->2,2}、{0->2,2}、{2->2,1}

A 只有一个标签:{1}、{2}、{},并且是您的有趣的三角形集。该标签不具有零行列式。
B 只有一个标签:{1,2}、{1,3}、{},并且是您的方形有趣集合。该标记不具有零行列式。

转换为代码作为练习留给读者(因为我必须去上班)。

The correct programming solution is, in outline:

  • Observe that centers come in projective pairs -- so identify and only retain the half of the centers that are in one or the other hemispherical covers of the set of centers. Pairs are set complements of each other. An example rule: all subsets containing vertex 1, and of those on the "equator", those containing vertex 2, and on that set's "equator", those containing vertex 3, and so on recursively keeping the boundary half adjacent to the smallest indexed vertex.
  • Observe that for every subsimplex, either the subsimplex is adjacent to vertex 1 or it is of distance 1 away from simplex. (Cause: each new vertex in the tetrahedron is attached to every previous vertex of the tetrahedron -- consequently every subsimplex is either incident on vertex 1 or vertex 1 is connected to every vertex in the simplex.) Consequently there are only two populations of each kind of subsimplex (with respect to a specified vertex). (We can replace this observation with the decision to only keep the smaller member of each projective pair, but then the rule for labeling vertices is more complicated.)
  • Tetrahedra are completely symmetric under permutation of vertex labels. Consequently, any "interesting section" is equivalent to another section containing only the leading segment of vertices -- i.e. can be identified among the vertices Range[1,n] for some n.

  • Collecting the above, we find that there is a surjection from interesting section to a set of graphs. For each graph we must enumerate consistent vertex memberships (described later). Except for one vertex, the vertices of the graph come in pairs

    • The pair contains all centers of a given cardinality (all subsimplices of a given dimension).
    • One member of the pair contains centers incident on vertex 1.
    • The other member of the pair contains centers not incident on vertex 1.
    • The special vertex is either the center containing all vertices or its projective pair (the "empty center").
    • If a graph contains any member of a pair it must (at least) contain the member containing centers incident on 1 (or the vertices can be relabeled to make this so).
  • The edges of the graph are weighted. The weight is the number of vertices shared by the two centers. There are restrictions on the weight based on the cardinality of the centers at each end and based on whether the two vertices are both first members, both second members, or are one of each. ("One of each" can't share vertex 1, for instance.)
  • A graph is a complete subgraph on the set of vertices, containing the special vertex. For instance for the tetrahedron, a graph is a K_{3} on the set of vertices identified above, with one vertex the special one and with edge weights.
  • A section is a graph with a consistent application of labels to the centers at the end of each edge (i.e. consistently labeled to respect the number of shared vertices indicated by the edge's weight and that each subset in one set of graph vertices contains vertex 1). A given graph can therefore represent multiple sections (via different labelings). (That there aren't as many options as it sounds as if there are will make sense in a second.)
  • A section is not interesting if the matrix made from the coordinates of its centers has zero determinant.

In the case of three dimensions, with four vertices, we get the following sets (we use the short projective pair because there's enough visibility in this example to not necessitate the simpler vertex labeling rejection rule):
0: projective pair of {1,2,3,4}
1: {1}
1': {2},{3},{4}
2: {1,2},{1,3},{1,4}
2': projective pairs to 2 (so omitted)
3: projective pairs to 1' (so omitted)
3': projective pairs to 1 (so omitted)

Label constraints:
{0->x,x}
{0->x',x}
{1->1,1} -- disallowed: centers are not included twice
{1->1',0}
{1->2,1}
{2->2,1}
No other weights are possible with these graph vertices.

A graph is a K_{3} incident on 0, the following graphs survive the graph selection rules:
A: {0->1,1},{0->1',1},{1->1',0}
B: {0->2,2},{0->2,2},{2->2,1}

A has only one labeling: {1},{2},{} and is your triangular interesting set. This labeling does not have zero determinant.
B has only one labeling: {1,2},{1,3},{} and is your square interesting set. This labeling does not have zero determinant.

Converting to code is left as an exercise to the reader (because I have to leave for work).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文