多面体#
- class sympy.combinatorics.polyhedron.Polyhedron(corners, faces=(), pgroup=())[源代码]#
表示多面体对称群(PSG)。
解释
PSG是柏拉图固体的对称群之一。共有三个多面体群:12级四面体群、24级八面体群和60级二十面体群。
所有doctest都在对象构造函数的docstring中给出。
工具书类
- property array_form#
返回角的索引。
给出了相对于角点原始位置的指标。
实例
>>> from sympy.combinatorics.polyhedron import tetrahedron >>> tetrahedron = tetrahedron.copy() >>> tetrahedron.array_form [0, 1, 2, 3]
>>> tetrahedron.rotate(0) >>> tetrahedron.array_form [0, 2, 3, 1] >>> tetrahedron.pgroup[0].array_form [0, 2, 3, 1]
参见
- property corners#
得到多面体的角。
方法
vertices
是一个别名corners
.实例
>>> from sympy.combinatorics import Polyhedron >>> from sympy.abc import a, b, c, d >>> p = Polyhedron(list('abcd')) >>> p.corners == p.vertices == (a, b, c, d) True
- property cyclic_form#
返回循环记数法中角点的索引。
给出了相对于角点原始位置的指标。
参见
- property edges#
根据多面体的面,我们可以得到边。
实例
>>> from sympy.combinatorics import Polyhedron >>> from sympy.abc import a, b, c >>> corners = (a, b, c) >>> faces = [(0, 1, 2)] >>> Polyhedron(corners, faces).edges {(0, 1), (0, 2), (1, 2)}
- property faces#
得到多面体的面。
- property pgroup#
得到多面体的排列。
- reset()[源代码]#
将拐角返回到其原始位置。
实例
>>> from sympy.combinatorics.polyhedron import tetrahedron as T >>> T = T.copy() >>> T.corners (0, 1, 2, 3) >>> T.rotate(0) >>> T.corners (0, 2, 3, 1) >>> T.reset() >>> T.corners (0, 1, 2, 3)
- rotate(perm)[源代码]#
对多面体应用置换 就位 . 置换可以是一个置换实例,也可以是一个整数,表示应该应用多面体的pgroup中的哪个置换。
这是一种类似于以固定增量绕轴旋转的操作。
笔记
当一个排列被应用时,不检查它是否是多面体的有效置换。例如,一个立方体可以被赋予一个置换,有效地只交换两个顶点。如果只使用
pgroup
多面体的。另一方面,允许任意旋转(排列的应用)提供了一种跟随命名元素而不是索引的方法,因为多面体允许顶点命名,而置换只对索引起作用。实例
>>> from sympy.combinatorics import Polyhedron, Permutation >>> from sympy.combinatorics.polyhedron import cube >>> cube = cube.copy() >>> cube.corners (0, 1, 2, 3, 4, 5, 6, 7) >>> cube.rotate(0) >>> cube.corners (1, 2, 3, 0, 5, 6, 7, 4)
本方法不禁止的非物理“旋转”:
>>> cube.reset() >>> cube.rotate(Permutation([[1, 2]], size=8)) >>> cube.corners (0, 2, 1, 3, 4, 5, 6, 7)
多面体可用于跟随集合中由字母而不是整数标识的元素:
>>> shadow = h5 = Polyhedron(list('abcde')) >>> p = Permutation([3, 0, 1, 2, 4]) >>> h5.rotate(p) >>> h5.corners (d, a, b, c, e) >>> _ == shadow.corners True >>> copy = h5.copy() >>> h5.rotate(p) >>> h5.corners == copy.corners False
- property size#
得到多面体的角数。
- property vertices#
得到多面体的角。
方法
vertices
是一个别名corners
.实例
>>> from sympy.combinatorics import Polyhedron >>> from sympy.abc import a, b, c, d >>> p = Polyhedron(list('abcd')) >>> p.corners == p.vertices == (a, b, c, d) True