λ°°κ²½
μλ ν리 κΈ°νΈλ μΌλ° polytopes λ° ν μ λ μ΄μ μ μ μνλ νν {P, Q, R, β¦}μ νκΈ°λ²μ λλ€.
SchlΓ€fli κΈ°νΈλ μ¬κ·μ μΈ μ€λͺ μΌλ‘, p-λ©΄ μ κ· λ€κ°νμΌλ‘ μμνμ¬ {p}μ λλ€. μλ₯Ό λ€μ΄ {3}μ μ μΌκ°ν, {4}λ μ μ¬κ°ν λ±μ λλ€.
κ° μ μ μ£Όμμ κ·μΉμ μΈ pλ©΄ λ€κ°νλ©΄μ΄ q μΈ κ·μΉμ μΈ λ€λ©΄μ²΄λ {p, q}λ‘ νμλ©λλ€. μλ₯Ό λ€μ΄, νλΈλ κ° μ μ μ£Όμμ 3 κ°μ μ¬κ°νμ κ°μ§λ©° {4,3}μΌλ‘ νμλ©λλ€.
κ° λͺ¨μ리 μ£Όμμ r {p, q} κ·μΉμ μΈ λ€λ©΄μ²΄ μ μ΄μλ κ·μΉμ μΈ 4 μ°¨μ ν΄λ¦¬ ν νλ {p, q, r}λ‘ νμλ©λλ€. μλ₯Ό λ€μ΄, ν μ λνΈ {4,3,3}μ κ°μ₯μ리 μ£Όμμ 3 κ°μ νλΈ {4,3}μ΄ μμ΅λλ€.
μΌλ°μ μΌλ‘ μΌλ° ν΄λ¦¬ ν ν {p, q, r, β¦, y, z}λ λͺ¨λ νΌν¬ μ£Όμμ z {p, q, r, β¦, y} ν¨μ―μ΄ μμΌλ©° νΌν¬λ λ€λ©΄μ²΄μ μ μ μ λλ€. 4- ν΄λ¦¬ ν νμ λͺ¨μ리, 5- ν΄λ¦¬ ν νμλ©΄, 6- ν΄λ¦¬ ν νμ μΈν¬, λ° n- ν΄λ¦¬ ν νμ (n-3)-λ©΄.
μΌλ° ν΄λ¦¬ ν νμλ μ μ μ΄ μ μ μ λλ€. μΌλ° ν΄λ¦¬ ν ν {p, q, r, β¦ y, z}μ κΌμ§μ μ {q, r, β¦ y, z}μ λλ€.
μΌλ° ν΄λ¦¬ ν νλ μ€κ°νκ³Ό κ°μ΄ λ³ λͺ¨μμ κΌμ§μ μΌλ‘ νμλκ³ κΈ°νΈκ° {5/2} μΈ λ³ λ€κ°ν μμλ₯Ό κ°μ§ μ μμ§λ§ κ΅λλ‘ μ°κ²°λ©λλ€.
SchlΓ€fli κΈ°νΈλ ꡬμ±μ κ°λ κ²°ν¨μ λ°λΌ μ ν λ³Όλ‘ λ€λ©΄μ²΄, μ ν΄λ¦¬λ 곡κ°μ κ³΅κ° λΆν λλ μ곑μ 곡κ°μ κ³΅κ° λΆν μ λνλΌ μ μμ΅λλ€. ν¬μ§ν°λΈ μ΅κΈ κ²°ν¨μ μ μ λνμ΄ λ λμ μ°¨μμΌλ‘ μ νκ³ ν΄λ¦¬ ν νλ‘ λ€μ 루νλ©λλ€. μ λ‘ κ°λ κ²°ν¨μ ν¨μ―κ³Ό λμΌν μΉμμ 곡κ°μ ν μ λ μ΄νΈν©λλ€. λ€κ±°ν°λΈ κ°λ κ²°ν¨μ μΌλ° 곡κ°μλ μ‘΄μ¬ν μ μμ§λ§ μ곑μ 곡κ°μλ κ΅¬μ± ν μ μμ΅λλ€.
κ²½μ
λΉμ μ λͺ©νλ SchlΓ€fli Symbolμ ν΅κ³Ό ν λ λ³Όλ‘ν ν΄λ¦¬ ν νμ λν μμ ν μ€λͺ μ λ°ννλ νλ‘κ·Έλ¨μ λ§λλ κ²μ λλ€. μ΄κ²μ SchlΓ€fli Symbolsμ μΌλΆμΌ λΏμ΄μ§ λ§ κ°μ₯ κ°λ¨ν κ²μ λλ€. λ€λ₯Έ κ°λ₯μ±μ΄ μμ΄λ μ΄κ²μ΄ λ§€μ° μ΄λ €μ΄ κ³Όμ λΌκ³ μκ°ν©λλ€. μ΄ μ§λ¬Έμ κ·μΉμμ΄ κ²°κ³Όκ° APIλΌλ μμ΄λμ΄λ‘ μ€κ³λμμΌλ©° μΈν°λ·μμ κ·Έλ¬ν νλ‘κ·Έλ¨μ μ°Ύμ μ μμμ΅λλ€.
νλ‘κ·Έλ¨μ λ€μμ λͺ¨λ λ¬μ±ν΄μΌν©λλ€.
- νλ‘κ·Έλ¨μ μ ν μ°¨μμ κ·μΉμ μΈ λ³Όλ‘ ν΄λ¦¬ ν νλ₯Ό μμ± ν μ μμ΄μΌν©λλ€. 2 μ°¨μμμ μ΄κ²μ n-gonμ ν¬ν¨ν©λλ€. 3 μ°¨μμμ μ΄λ€μ νλΌν€ κ³ μ²΄μ΄λ©°, 4 μ°¨μμμ μ΄κ²μ μ μ¬κ°ν, μ μ¬ν λ° κΈ°νλ₯Ό ν¬ν¨ν©λλ€)
- νλ‘κ·Έλ¨μ (a) μμ μ μ μ λ°°μΉνκ±°λ (b) λͺ¨λ μ μ νκ· μ΄ μμ μΈμ§ νμΈν΄μΌν©λλ€. μ€λ¦¬μν μ΄μ μ μ€μνμ§ μμ΅λλ€. μ 체 ν¬κΈ°λ μ€μνμ§ μμ΅λλ€.
- νλ‘κ·Έλ¨μ μμ ν μ€λͺ μ μ 곡νμ¬ 4 μ°¨μ κ°μ²΄μ κ²½μ° μ μ , λͺ¨μ리,λ©΄ λ° λ€λ©΄μ²΄λ₯Ό λ°ν / μΈμν©λλ€. μ΄λ¬ν μμλ μ€μνμ§ μμ΅λλ€. λ€λ©΄μ²΄μ κ²½μ°, μ΄λ κ°μ²΄λ₯Ό λ λλ§νλ λ° νμν μ 보μ λλ€.
λ€μ μ μ²λ¦¬ ν νμ κ° μμ΅λλ€ .
- ν μ λ μ΄μ
- μ곑μ κΈ°νν
- λΆμ SchlΓ€fli κΈ°νΈ (λ³Όλ‘νμ§ μμ)
- λ΄μ₯ λ SchlΓ€fli κΈ°νΈ (λΉ κ· μΌ νμΌλ§)
μ΄λ¬ν μμ μ μννλΌλ λ©μμ§κ° νμλλ©΄ μ€λ₯λ₯Ό λ°ν ν μ μμ΅λλ€.
μ : νλΈ
μ λ ₯:
4 3
μ°μΆ:
Vertices
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
Edges (These are the vertex pairs that make up the edges)
0 1
0 2
0 4
1 3
1 5
2 3
2 6
3 7
4 5
4 6
5 7
6 7
Faces (These are the squares which are the faces of the cube)
0 1 3 2
0 1 5 4
0 2 6 4
6 7 5 4
7 6 2 3
7 5 1 3
μ΄ μκ³ λ¦¬μ¦μ΄ μ΄λ»κ² μλνκ³ λ§€μ° μ¬κ· μ μΌμ§μ λν μμ΄λμ΄κ° μμμ§λ§ μ§κΈκΉμ§λ μ€ν¨νμ§λ§ μκ°μ μ°Ύκ³ μλ€λ©΄ λ€μμ νμΈνμμμ€. https://en.wikipedia.org/wiki/Euler_characteristic
μ μ , λͺ¨μ리 λ°λ©΄μ μλ₯Ό κ³μ°νλ μλ‘, {4,3} μΈ νλΈλ₯Ό κ³ λ €νμμμ€. μ΄κΈ° 4 κ°λ₯Ό 보면 4 κ°μ λͺ¨μ리μ 4 κ°μ μ μ μ΄ μμ΅λλ€. λ€μ 3 κ°λ₯Ό 보면 κ° κΌμ§μ μμ 3 κ°μ λͺ¨μλ¦¬κ° λ§λκ³ , κ° λͺ¨μλ¦¬κ° 2 κ°μ κΌμ§μ μ μ°κ²°λκ³ , 2 κ°μλ©΄μ΄ κ° λͺ¨μ리μμ λ§λκ³ , κ°λ©΄μ΄ 4 κ°μ λͺ¨μ리 (μ¬κ°ν λλ¬Έμ)μ μ°κ²°λ¨μ μ μ μμ΅λλ€. μ€μΌλ¬ νΉμ± 곡μ.
E = 3/2 V
E = 4/2 F
V-E + F = 2
μ΄λ E = 12, V = 8, F = 6μ μ 곡ν©λλ€.
μ±μ
μ£Όμ μ λν μ§λ¬Έμ μ μ§νκΈ° μν΄ μ½λ 골νλ‘ κ°μ λμμ΅λλ€. κ°μ₯ μ§§μ μ½λκ° μΉλ¦¬ν©λλ€.
λ΅λ³
νμ΄μ¬
νΉλ³ν κ²½μ°κ°μλ μ¬κ· νλ‘κ·Έλ¨μ΄ μμ΅λλ€. λΉ μ€κ³Ό μ£Όμμ 무μ νκ³ , λ§μ§λ§μ μ€μΌλ¬ 곡μμ μ κ²νλ κ²μ ν¬ν¨νμ¬ 100 90 μ€ λ―Έλ§ μ
λλ€. λΌμ΄λΈλ¬λ¦¬μμ μ 곡 ν μμλ μμ μν ν¨μ λ° i ββ/ oμ μ μλ₯Ό μ μΈνλ©΄ ν΄λ¦¬ ν ν μμ±μ 50 μ€μ μ½λμ
λλ€. κ·Έλ¦¬κ³ μ¬μ§μ΄ μ€ν ν΄λ¦¬ ν νλν©λλ€!
μΆλ ₯ ν΄λ¦¬ ν νμ κ°μ₯μ리 κΈΈμ΄λ 1μ΄λ©° λ€μκ³Ό κ°μ μλ―Έμμ νμ€ μμΉ λ° λ°©ν₯μ΄λ©λλ€.
- 첫 λ²μ§Έ μ μ μ μμ μ λλ€.
- 첫 λ²μ§Έ κ°μ₯μ리λ + x μΆμ λ°λΌ μμΌλ©°
- 첫 λ²μ§Έλ©΄μ xy νλ©΄μ + y λ° νλ©΄μ μκ³
- 첫 λ²μ§Έ 3 μ μ xyz 곡κ°μ + z λ° κ³΅κ°μ μμ΅λλ€.
κ·Έ μΈμλ μΆλ ₯ λͺ©λ‘μ΄ νΉμ μμκ° μλλλ€. (μ, μ¬μ€, 그건 μλμμ μμ ν κ·Έλ€μ΄ μ€μ λ‘ μμλ 첫 λ²μ§Έ μμμμ μμνμ¬ λ°κΉ₯μͺ½μΌλ‘ νμ₯μ λλ΅ λμ¬ κ² trueβ.)
μ ν¨νμ§ μμ schlafli κΈ°νΈλ₯Ό κ²μ¬νμ§ μμ΅λλ€. λΉμ μ΄ νλλ₯Ό μ£Όλ©΄, νλ‘κ·Έλ¨μ μλ§λ λ μΌμμ λ²μ΄λ κ²μ λλ€ (λμλ 루ν, μ€ν μ€λ²νλ‘ λλ κ·Έλ₯ μ°λ κΈ°).
{4,4} λλ {3,6} λλ {6,3}κ³Ό κ°μ 무ν νλ©΄ νμΌλ§μ μμ²νλ©΄ νλ‘κ·Έλ¨μ μ€μ λ‘ νμΌλ§μ μμ±νκΈ° μμνμ§λ§ 곡κ°μ΄ λΆμ‘±ν΄μ§ λκΉμ§ μμν κ³μλ©λλ€. λ§λ¬΄λ¦¬ λλ μμ° μΆλ ₯. μ΄κ²μ μμ νκΈ°κ° λ무 μ΄λ ΅μ§ μμ΅λλ€ (μμ± ν μμ μμ μ νμ λμμμ€. μμλ λλ΅ λλΉκ° λμ 첫 λ²μ§Έ κ²μ μμλ‘ μμ±λλ―λ‘ κ²°κ³Όλ 무νν κ·Έλ¦Όμ μλΉν μΌκ΄λ μμμ΄μ΄μΌν©λλ€).
μ½λ
#!/usr/bin/python3
# (works with python2 or python3)
#
# schlafli_interpreter.py
# Author: Don Hatch
# For: /codegolf/114280/schl%C3%A4fli-convex-regular-polytope-interpreter
#
# Print the vertex coords and per-element (edges, faces, etc.) vertex index
# lists of a regular polytope, given by its schlafli symbol {p,q,r,...}.
# The output polytope will have edge length 1 and will be in canonical position
# and orientation, in the following sense:
# - the first vertex is the origin,
# - the first edge lies along the +x axis,
# - the first face is in the +y half-plane of the xy plane,
# - the first 3-cell is in the +z half-space of the xyz space, etc.
# Other than that, the output lists are in no particular order.
#
import sys
from math import *
# vector minus vector.
def vmv(a,b): return [x-y for x,y in zip(a,b)]
# matrix minus matrix.
def mmm(m0,m1): return [vmv(row0,row1) for row0,row1 in zip(m0,m1)]
# scalar times vector.
def sxv(s,v): return [s*x for x in v]
# scalar times matrix.
def sxm(s,m): return [sxv(s,row) for row in m]
# vector dot product.
def dot(a,b): return sum(x*y for x,y in zip(a,b))
# matrix outer product of two vectors; that is, if a,b are column vectors: a*b^T
def outer(a,b): return [sxv(x,b) for x in a]
# vector length squared.
def length2(v): return dot(v,v)
# distance between two vectors, squared.
def dist2(a,b): return length2(vmv(a,b))
# matrix times vector, homogeneous (i.e. input vector ends with an implicit 1).
def mxvhomo(m,v): return [dot(row,v+[1]) for row in m]
# Pad a square matrix (rotation/reflection) with an extra column of 0's on the
# right (translation).
def makehomo(m): return [row+[0] for row in m]
# Expand dimensionality of homogeneous transform matrix by 1.
def expandhomo(m): return ([row[:-1]+[0,row[-1]] for row in m]
+ [[0]*len(m)+[1,0]])
# identity matrix
def identity(dim): return [[(1 if i==j else 0) for j in range(dim)]
for i in range(dim)]
# https://en.wikipedia.org/wiki/Householder_transformation. v must be unit.
# Not homogeneous (makehomo the result if you want that).
def householderReflection(v): return mmm(identity(len(v)), sxm(2, outer(v,v)))
def sinAndCosHalfDihedralAngle(schlafli):
# note, cos(pi/q)**2 generally has a nicer expression with no trig and often
# no radicals, see http://www.maths.manchester.ac.uk/~cds/articles/trig.pdf
ss = 0
for q in schlafli: ss = cos(pi/q)**2 / (1 - ss)
if abs(1-ss) < 1e-9: ss = 1 # prevent glitch in planar tiling cases
return sqrt(ss), sqrt(1 - ss)
# Calculate a set of generators of the symmetry group of a {p,q,r,...} with
# edge length 1.
# Each generator is a dim x (dim+1) matrix where the square part is the initial
# orthogonal rotation/reflection and the final column is the final translation.
def calcSymmetryGenerators(schlafli):
dim = len(schlafli) + 1
if dim == 1: return [[[-1,1]]] # one generator: reflect about x=.5
facetGenerators = calcSymmetryGenerators(schlafli[:-1])
# Start with facet generators, expanding each homogeneous matrix to full
# dimensionality (i.e. from its previous size dim-1 x dim to dim x dim+1).
generators = [expandhomo(gen) for gen in facetGenerators]
# Final generator will reflect the first facet across the hyperplane
# spanned by the first ridge and the entire polytope's center,
# taking the first facet to a second facet also containing that ridge.
# v = unit vector normal to that bisecting hyperplane
# = [0,...,0,-sin(dihedralAngle/2),cos(dihedralAngle/2)]
s,c = sinAndCosHalfDihedralAngle(schlafli)
v = [0]*(dim-2) + [-s,c]
generators.append(makehomo(householderReflection(v)))
return generators
# Key for comparing coords with roundoff error. Makes sure the formatted
# numbers are not very close to 0, to avoid them coming out as "-0" or "1e-16".
# This isn't reliable in general, but it suffices for this application
# (except for very large {p}, no doubt).
def vert2key(vert): return ' '.join(['%.9g'%(x+.123) for x in vert])
# Returns a pair verts,edgesEtc where edgesEtc is [edges,faces,...]
def regular_polytope(schlafli):
dim = len(schlafli) + 1
if dim == 1: return [[0],[1]],[]
gens = calcSymmetryGenerators(schlafli)
facetVerts,facetEdgesEtc = regular_polytope(schlafli[:-1])
# First get all the verts, and make a multiplication table.
# Start with the verts of the first facet (padded to full dimensionality),
# so indices will match up.
verts = [facetVert+[0] for facetVert in facetVerts]
vert2index = dict([[vert2key(vert),i] for i,vert in enumerate(verts)])
multiplicationTable = []
iVert = 0
while iVert < len(verts): # while verts is growing
multiplicationTable.append([None] * len(gens))
for iGen in range(len(gens)):
newVert = mxvhomo(gens[iGen], verts[iVert])
newVertKey = vert2key(newVert)
if newVertKey not in vert2index:
vert2index[newVertKey] = len(verts)
verts.append(newVert)
multiplicationTable[iVert][iGen] = vert2index[newVertKey]
iVert += 1
# The higher-level elements of each dimension are found by transforming
# the facet's elements of that dimension. Start by augmenting facetEdgesEtc
# by adding one more list representing the entire facet.
facetEdgesEtc.append([tuple(range(len(facetVerts)))])
edgesEtc = []
for facetElementsOfSomeDimension in facetEdgesEtc:
elts = facetElementsOfSomeDimension[:]
elt2index = dict([[elt,i] for i,elt in enumerate(elts)])
iElt = 0
while iElt < len(elts): # while elts is growing
for iGen in range(len(gens)):
newElt = tuple(sorted([multiplicationTable[iVert][iGen]
for iVert in elts[iElt]]))
if newElt not in elt2index:
elt2index[newElt] = len(elts)
elts.append(newElt)
iElt += 1
edgesEtc.append(elts)
return verts,edgesEtc
# So input numbers can be like any of "8", "2.5", "7/3"
def parseNumberOrFraction(s):
tokens = s.split('/')
return float(tokens[0])/float(tokens[1]) if len(tokens)==2 else float(s)
if sys.stdin.isatty():
sys.stderr.write("Enter schlafli symbol (space-separated numbers or fractions): ")
sys.stderr.flush()
schlafli = [parseNumberOrFraction(token) for token in sys.stdin.readline().split()]
verts,edgesEtc = regular_polytope(schlafli)
# Hacky polishing of any integers or half-integers give or take rounding error.
def fudge(x): return round(2*x)/2 if abs(2*x-round(2*x))<1e-9 else x
print(repr(len(verts))+' Vertices:')
for v in verts: print(' '.join([repr(fudge(x)) for x in v]))
for eltDim in range(1,len(edgesEtc)+1):
print("")
elts = edgesEtc[eltDim-1]
print(repr(len(elts))+' '+('Edges' if eltDim==1
else 'Faces' if eltDim==2
else repr(eltDim)+'-cells')+" ("+repr(len(elts[0]))+" vertices each):")
for elt in elts: print(' '.join([repr(i) for i in elt]))
# Assert the generalization of Euler's formula: N0-N1+N2-... = 1+(-1)**(dim-1).
N = [len(elts) for elts in [verts]+edgesEtc]
eulerCharacteristic = sum((-1)**i * N[i] for i in range(len(N)))
print("Euler characteristic: "+repr(eulerCharacteristic))
if 2.5 not in schlafli: assert eulerCharacteristic == 1 + (-1)**len(schlafli)
κ²½μ°μ λ°λΌ μλ
μ λ ₯ ( μ 방체 ) :
4 3
μ°μΆ:
8 Vertices:
0.0 0.0 0.0
1.0 0.0 0.0
0.0 1.0 0.0
1.0 1.0 0.0
0.0 0.0 1.0
1.0 0.0 1.0
0.0 1.0 1.0
1.0 1.0 1.0
12 Edges (2 vertices each):
0 1
0 2
1 3
2 3
0 4
1 5
4 5
2 6
4 6
3 7
5 7
6 7
6 Faces (4 vertices each):
0 1 2 3
0 1 4 5
0 2 4 6
1 3 5 7
2 3 6 7
4 5 6 7
μ λμ€ μ»€λ§¨λ μ ( 120-cell polychoron )μμ μ λ ₯ :
$ echo "5 3 3" | ./schlafli_interpreter.py | grep ":"
μ°μΆ:
600 Vertices:
1200 Edges (2 vertices each):
720 Faces (5 vertices each):
120 3-cells (20 vertices each):
μ λ ₯ (10 μ°¨μ κ΅μ°¨ ν΄λ¦¬ ν ν ) :
$ echo "3 3 3 3 3 3 3 3 4" | ./schlafli_interpreter.py | grep ":"
μ°μΆ:
20 Vertices:
180 Edges (2 vertices each):
960 Faces (3 vertices each):
3360 3-cells (4 vertices each):
8064 4-cells (5 vertices each):
13440 5-cells (6 vertices each):
15360 6-cells (7 vertices each):
11520 7-cells (8 vertices each):
5120 8-cells (9 vertices each):
1024 9-cells (10 vertices each):
μ λ ₯ (15 μ°¨μ μ¬ν λ μ€ ) :
$ echo "3 3 3 3 3 3 3 3 3 3 3 3 3 3" | ./schlafli_interpreter.py | grep ":"
16 Vertices:
120 Edges (2 vertices each):
560 Faces (3 vertices each):
1820 3-cells (4 vertices each):
4368 4-cells (5 vertices each):
8008 5-cells (6 vertices each):
11440 6-cells (7 vertices each):
12870 7-cells (8 vertices each):
11440 8-cells (9 vertices each):
8008 9-cells (10 vertices each):
4368 10-cells (11 vertices each):
1820 11-cells (12 vertices each):
560 12-cells (13 vertices each):
120 13-cells (14 vertices each):
16 14-cells (15 vertices each):
λ³ ν΄λ¦¬ ν ν
ν, κ·Έλ¦¬κ³ κ·Έκ²μ μμ°μ€λ½κ² μ€ν ν΄λ¦¬ ν νλν©λλ€! λλ μλμ‘°μ°¨ ν νμμ‘°μ°¨ μμμ΅λλ€ π Eulerμ 곡μμ κ΄ν λΉνΈκ° μ€ν¨νλ€λ κ²μ μ μΈνκ³ λ κ·Έ 곡μμ΄ μ€ν ν΄λ¦¬ ν νμ μ ν¨νμ§ μκΈ° λλ¬Έμ μ€ν¨ν©λλ€.
μ λ ₯ ( μμ λ³ λͺ¨μ μμ΄ λ©΄μ²΄ ) :
5/2 5
μ°μΆ:
12 Vertices:
0.0 0.0 0.0
1.0 0.0 0.0
0.8090169943749473 0.5877852522924732 0.0
0.19098300562505266 0.5877852522924732 0.0
0.5 -0.36327126400268034 0.0
0.8090169943749473 -0.2628655560595667 0.5257311121191336
0.19098300562505266 -0.2628655560595667 0.5257311121191336
0.5 0.162459848116453 -0.3249196962329062
0.5 0.6881909602355867 0.5257311121191336
0.0 0.32491969623290623 0.5257311121191336
0.5 0.1624598481164533 0.8506508083520398
1.0 0.32491969623290623 0.5257311121191336
30 Edges (2 vertices each):
0 1
0 2
1 3
2 4
3 4
0 5
1 6
5 7
6 7
0 8
2 9
7 8
7 9
1 8
0 10
3 11
5 9
4 10
7 11
4 9
2 5
1 10
4 11
6 11
6 8
3 10
3 6
2 10
9 11
5 8
12 Faces (5 vertices each):
0 1 2 3 4
0 1 5 6 7
0 2 7 8 9
1 3 7 8 11
0 4 5 9 10
2 4 5 7 11
1 4 6 10 11
0 3 6 8 10
3 4 6 7 9
2 3 9 10 11
1 2 5 8 10
5 6 8 9 11
Traceback (most recent call last):
File "./schlafli_interpreter.py", line 185, in <module>
assert sum((-1)**i * N[i] for i in range(len(N))) == 1 + (-1)**len(schlafli)
AssertionError
μ λ ₯ ( ν° λ³ λͺ¨μμ 120 μ ) :
$ echo "5/2 3 5" | ./schlafli_interpreter.py | grep ":"
μ°μΆ:
120 Vertices:
720 Edges (2 vertices each):
720 Faces (5 vertices each):
120 3-cells (20 vertices each):
λ΅λ³
루λΉ
λ°°κ²½
무ν μΉμλ‘ νμ₯λλ μΌλ° ν΄λ¦¬ ν ν μ νκ΅°μλ μΈ κ°μ§κ° μμ΅λλ€.
-
μ¬λ©΄μ²΄κ° ꡬμ±μ μΈ λ¨λ©΄ (λ¨μμ΄λΌλ μ©μ΄κ° λ μ ννμ§λ§ μ¬κΈ°μλ μ’ μ’ μ μ¬λ©΄μ²΄λΌκ³ λΆλ¦ λλ€)
{3,3,...,3,3}
-
νλΈκ° λ©€λ² μΈ n- νλΈ κ·Έλ€μ schlafi κΈ°νΈλ ννμ λλ€
{4,3,...,3,3}
-
μ ν면체λ μ νλ©΄μ²΄κ° λ©€λ²μ λλ€ (μ λ μ’ μ’ μ ν면체λΌκ³ λΆλ¦ λλ€) κ·Έλ€μ μμ§ κΈ°νΈλ ννμ λλ€
{3,3,...,3,4}
μΌλ° ν΄λ¦¬ ν νμ μΆκ° 무ν ν¨λ°λ¦¬κ° μμ΅λλ€. {m}
2 κ°μ ν΄λ¦¬κ³€ κ° μμΌλ©°, μ΄λ μμμ κ°μμ μμ§ (m)λ₯Ό κ°μ§ μμλ€.
μ΄μ λνμ¬, κ·μΉμ μΈ ν΄λ¦¬ ν νμ λ€λ₯Έ 5 κ°μ§ νΉλ³ν κ²½μ°κ°μλ€ : 3 μ°¨μ μ μ΄μ 면체 {3,5}
μ μμ΄ λ©΄μ²΄ {5,3}
; κ·Έλ€μ 4 μ°¨μ μ μ¬μ²΄ 600- μ
{3,3,5}
λ° 120- μ
{5,3,3}
; λ€λ₯Έ 4 μ°¨μ ν΄λ¦¬ ν ν μΈ 24 μ
{3,4,3}
(3 μ°¨μμμ κ°μ₯ κ°κΉμ΄ μ μ¬μ²΄λ μ‘면체μ κ·Έ μ΄μ€ λ§λ¦λͺ¨κΌ΄ μμ΄ λ©΄μ²΄).
μ£Όμ κΈ°λ₯
λ€μμ polytope
schlafi κΈ°νΈλ₯Ό ν΄μ νλ μ£Όμ κΈ°λ₯μ
λλ€. μ«μ λ°°μ΄μ μμνκ³ λ€μκ³Ό κ°μ΄ μ¬λ¬ λ°°μ΄μ ν¬ν¨νλ λ°°μ΄μ λ°νν©λλ€.
-
λͺ¨λ μ μ μ λ°°μ΄λ‘, κ°κ° n μμμ μ’ν λ°°μ΄λ‘ ννλ©λλ€ (μ¬κΈ°μ nμ μ°¨μ μμ λλ€).
-
λͺ¨λ λͺ¨μ리μ λ°°μ΄λ‘ κ°κ° μ μ μμΈμ 2 μμλ‘ νμλ©λλ€.
-
λͺ¨λ λ©΄μ λ°°μ΄λ‘, κ°κ° μ μ μμΈμ m- μμλ‘ νμλ©λλ€ (μ¬κΈ°μ mμ λ©΄λΉ μ μ μ μμ)
μΉμμ μμ λ°λΌ μ μ νκ² λ±λ±.
2d ν΄λ¦¬ ν ν μ체λ₯Ό κ³μ°νκ³ 3 κ°μ 무ν μΉμ ν¨λ°λ¦¬μ λν ν¨μλ₯Ό νΈμΆνκ³ 5 κ°μ νΉμν κ²½μ°μ λν΄ μ‘°ν ν μ΄λΈμ μ¬μ©ν©λλ€. μμ μ μΈ λ ν¨μμ ν μ΄λΈμ μ°Ύμ κ²μΌλ‘ μμλ©λλ€.
include Math
#code in subsequent sections of this answer should be inserted here
polytope=->schl{
if schl.size==1 #if a single digit calculate and return a polygon
return [(1..schl[0]).map{|i|[sin(PI*2*i/schl[0]),cos(PI*2*i/schl[0])]},(1..schl[0]).map{|i|[i%schl[0],(i+1)%schl[0]]}]
elsif i=[[3,5],[5,3]].index(schl) #if a 3d special, lookup from tables
return [[vv,ee,ff],[uu,aa,bb]][i]
elsif i=[[3,3,5],[5,3,3],[3,4,3]].index(schl) #if a 4d special. lookup fromm tables
return [[v,e,f,g],[u,x,y,z],[o,p,q,r]][i]
elsif schl.size==schl.count(3) #if all threes, call tetr for a hypertetrahedron
return tetr[schl.size+1]
elsif schl.size-1==schl.count(3) #if all except one number 3
return cube[schl.size+1] if schl[0]==4 #and the 1st digit is 4, call cube for a hypercube
return octa[schl.size+1] if schl[-1]==4 #and the last digit is 4, call octa for a hyperoctahedron
end
return "error" #in any other case return an error
}
4 면체, μ μ‘면체 λ° 8 면체 κ°μ‘±μμν ν¨μ
https://en.wikipedia.org/wiki/Simplex
https://ko.wikipedia.org/wiki/5-cell (4D μ¬ν λ μ€)
http://mathworld.wolfram.com/Simplex.html
μ μ¬κ°ν κ°μ‘± μ€λͺ -μ’ν
n- μ°¨μ μ¬ν λ μ€ / μ‘면체λ n + 1 ν¬μΈνΈλ₯Ό κ°λλ€. n + 1 μ°¨μμ n μ°¨μ μ¬ν λ μ€μ μ μ μ μ 곡νλ κ²μ λ§€μ° μ½μ΅λλ€.
λ°λΌμ (1,0,0),(0,1,0),(0,0,1)
3 μ°¨μμ ν¬ν¨ λ 2 μ°¨μ μΌκ°νκ³Ό (1,0,0,0),(0,1,0,0),(0,0,1,0),(0,0,0,1)
4 μ°¨μμ ν¬ν¨ λ 3 μ°¨μ 4 면체λ₯Ό μ€λͺ
ν©λλ€. μ΄κ²μ κΌμ§μ μ¬μ΄μ λͺ¨λ κ±°λ¦¬κ° sqrt (2)μΈμ§ νμΈνμ¬ μ½κ² νμΈν μ μμ΅λλ€.
n μ°¨μ 곡κ°μμ n μ°¨μ μ¬ν λ μ€μ κΌμ§μ μ μ°ΎκΈ° μν΄ μΈν°λ·μ λ€μν 볡μ‘ν μκ³ λ¦¬μ¦μ΄ μ 곡λ©λλ€. μ΄ λ΅λ³ /mathpro//a/38725 μ λν Will Jagyμ μ견μμ λλλλ‘ κ°λ¨ν κ²μ λ°κ²¬νμ΅λλ€ . λ§μ§λ§ μ§μ μ λ€λ₯Έ μ§μ p=q=...=x=y=z
μμ sqrt (2) 거리 μμλ μ μ μμ΅λλ€. λ°λΌμ μμ μΌκ°νμ (-1/3,-1/3,-1/3)
λλμ μ μ μΆκ°νμ¬ 4 λ©΄μ²΄λ‘ λ³ν ν μ μμ΅λλ€ (1,1,1)
. λ§μ§λ§ μ μ λνμ΄ λ κ°μ§ κ°λ₯ν μ’ν κ°μ (1-(1+n)**0.5)/n
λ°(1+(1+n)**0.5)/n
μ§λ¬Έμ λ°λ₯΄λ©΄ n-topeμ ν¬κΈ°λ μ€μνμ§ μμΌλ―λ‘ nμ κ³±νκ³ t = λ¨μν μ μ΅μ’
μ§μ (n,0,0..0)
κΉμ§ μ’ν λ₯Ό μ¬μ©νλ κ²μ΄ μ’μ΅λλ€.(0..0,0,n)
(t,t,..,t,t)
1-(1+n)**0.5
μ΄ 4 면체μ μ€μ¬μ΄ μμ μ μμ§ μκΈ° λλ¬Έμ λͺ¨λ μ’νμ λν μμ s.map!{|j|j-((1-(1+n)**0.5)+n)/(1+n)}
μ μ€μ¬μ΄ μμ μμ μΌλ§λ λ¨μ΄μ Έ μλμ§ μ°Ύμμ λΉΌλ μ μΌλ‘ μ΄λ£¨μ΄μ ΈμΌ ν©λλ€. λλ μ΄κ²μ λ³λμ μμ
μΌλ‘ μ μ§νλ€. κ·Έλ¬λ λ°°μ΄μ μ΄κΈ°ν ν λ μ¬κΈ°μ μ¬λ°λ₯Έ μ€νμ
μ λ°°μΉνκ³ λμ΄ μλ μ²μμ μ€μ¬ μ‘°μ μ μν ν μ μλ€λ μ¬μ€μ μμνκΈ° μν΄ s[i]+=n
μ΄λμμ s[i]=n
ν κ²μΈμ§λ₯Ό μ¬μ© s=[0]*n
νμ΅λλ€.
μ¬λ©΄μ²΄ κ°μ‘± μ€λͺ -κ·Έλν ν ν΄λ‘μ§
μ¬ν λ μ€μ κ·Έλνλ μμ ν κ·Έλνμ λλ€. λͺ¨λ μ μ μ λ€λ₯Έ λͺ¨λ μ μ μ μ νν ν λ² μ°κ²°λ©λλ€. λ§μ½ μ°λ¦¬κ° n κ°μ λ¨λ©΄μ κ°μ§κ³ μλ€λ©΄, μ μ μ μ κ±°νμ¬ μΌκ°νμ΄λ κ°μ₯μ리κ°μλ μ§μ κΉμ§ n-1μ λ¨λ©΄μ μ€ μ μμ΅λλ€.
λ°λΌμ μ°λ¦¬λ μΉ΄νλ‘κ·Έμ μ΄ 2 ** (n + 1) κ°μ νλͺ©μ κ°μ§κ³ μμΌλ©° κ°κ°μ μ΄μ§μλ‘ νμλ©λλ€. μ΄κ²μ 0
무μλ―Έμ λν λͺ¨λ κ²μμλΆν° 1
μ μ μ λν νλ μ 1
κ°μ₯μ리μ λν 2 κ°μ 1
κ²λΆν° μμ ν ν΄λ¦¬ ν νμ λν λͺ¨λ κ²κΉμ§ λ€μ ν©λλ€.
κ° ν¬κΈ°μ μμλ₯Ό μ μ₯νκΈ° μν΄ λΉ λ°°μ΄μ λ°°μ΄μ μ€μ νμ΅λλ€. κ·Έλ° λ€μ 0μμ (2 ** n + 1)κΉμ§ λ°λ³΅νμ¬ κ°λ₯ν μ μ μ κ° νμ μ§ν©μ μμ±νκ³ κ° νμ μ§ν©μ ν¬κΈ°μ λ°λΌ λ°°μ΄μ μ μ₯ν©λλ€.
μ°λ¦¬λ κ°μ₯μλ¦¬λ³΄λ€ μμ κ² (μ μ λλ 0)μ΄λ μμ ν ν΄λ¦¬ ν ν (λ¬Έμ μ μμμ μμ ν νλΈκ° μ 곡λμ§ μκΈ° λλ¬Έμ)μ κ΄μ¬μ΄ μμΌλ―λ‘ tg[2..n]
μ΄λ¬ν μμΉ μλ μμλ₯Ό μ κ±°νκΈ° μν΄ λμκ°λλ€ . λμ μ€κΈ° μ μ μ μ μ’νκ° ν¬ν¨ λ [tv]λ₯Ό μμ λΆλΆμ λΆμ
λλ€.
μνΈ
tetr=->n{
#Tetrahedron Family Vertices
tv=(0..n).map{|i|
s=[0]*n
if i==n
s.map!{(1-(1+n)**0.5)}
else
s[i]+=n
end
s.map!{|j|j-((1-(1+n)**0.5)+n)/(1+n)}
s}
#Tetrahedron Family Graph
tg=(0..n+1).map{[]}
(2**(n+1)).times{|i|
s=[]
(n+1).times{|j|s<<j if i>>j&1==1}
tg[s.size]<<s
}
return [tv]+tg[2..n]}
cube=->n{
#Cube Family Vertices
cv=(0..2**n-1).map{|i|s=[];n.times{|j|s<<(i>>j&1)*2-1};s}
#Cube Family Graph
cg=(0..n+1).map{[]}
(3**n).times{|i| #for each point
s=[]
cv.size.times{|j| #and each vertex
t=true #assume vertex goes with point
n.times{|k| #and each pair of opposite sides
t&&= (i/(3**k)%3-1)*cv[j][k]!=-1 #if the vertex has kingsmove distance >1 from point it does not belong
}
s<<j if t #add the vertex if it belongs
}
cg[log2(s.size)+1]<<s if s.size > 0
}
return [cv]+cg[2..n]}
octa=->n{
#Octahedron Family Vertices
ov=(0..n*2-1).map{|i|s=[0]*n;s[i/2]=(-1)**i;s}
#Octahedron Family Graph
og=(0..n).map{[]}
(3**n).times{|i| #for each point
s=[]
ov.size.times{|j| #and each vertex
n.times{|k| #and each pair of opposite sides
s<<j if (i/(3**k)%3-1)*ov[j][k]==1 #if the vertex is located in the side corresponding to the point, add the vertex to the list
}
}
og[s.size]<<s
}
return [ov]+og[2..n]}
νλΈ λ° ν면체 κ°μ‘± μ€λͺ -μ’ν
n- νλΈμλ 2**n
κ°κ° n 1
κ³Ό -1
s μ λ°°μ΄λ‘ ννλλ κΌμ§μ μ΄ μμ΅λλ€ (λͺ¨λ κ°λ₯μ±μ΄ νμ©λ©λλ€). λͺ¨λ μ μ λͺ©λ‘μ μμΈ 0
μ λ°λ³΅ 2**n-1
νκ³ κ° μ μ μ λΉνΈλ₯Ό λ°λ³΅νμ¬ κ° κΌμ§μ μ λν λ°°μ΄μ λ§λλλ€. μΈλ±μ€ λ° λ°°μ΄ μΆκ° -1
λλ 1
λ°°μ΄ (μ΅νμ λΉνΈμμ μ΅μμ λΉνΈ). λ°λΌμ μ΄ν 1101
μ 4d ν¬μΈνΈκ° [1,-1,1,1]
λ©λλ€.
n-octahedron λλ n-orthoplexλ 2n
κΌμ§μ μ κ°μ§λ©° , λͺ¨λ μ’νλ 0μ μ μΈνκ³ λ 0 1
μ΄κ±°λ λλ -1
μ
λλ€. μμ± λ λ°°μ΄μ κΌμ§μ μμλ [[1,0,0..],[-1,0,0..],[0,1,0..],[0,-1,0..],[0,0,1..],[0,0,-1..]...]
μ
λλ€. 8 면체λ μ
방체μ μ΄μ€μ΄λ―λ‘, 8 면체μ κΌμ§μ μ κ·Έκ²μ λλ¬μΈλ μ
방체면μ μ€μ¬μ μν΄ μ μλ©λλ€.
νλΈ λ° 8 면체 κ°μ‘± μ€λͺ -κ·Έλν ν ν΄λ‘μ§
νμ΄νΌ νλΈ μΈ‘λ©΄ μμ μ½κ°μ μκ°μ μ»μμΌλ©° νμ΄νΌ νλ©΄μ²΄κ° νμ΄νΌ νλΈμ μ΄μ€μ΄λΌλ μ¬μ€μ΄ μμ΅λλ€.
n- νλΈμ κ²½μ° 3**n
μΉ΄νλ‘κ·Έ ν νλͺ© μ΄ μμ΅λλ€. μλ₯Ό λ€μ΄, 3 νλΈμλ 3**3
= 27 κ°μ μμκ° μμ΅λλ€. μ€μ¬μ 1 κ°,λ©΄ 6 κ°, λͺ¨μ리 12 κ°, κΌμ§μ 8 κ°λ‘ μ΄ 27 κ°μ 루λΉ
μ€ νλΈλ₯Ό μ°κ΅¬νλ©΄ μ μ μμ΅λλ€. .. νλΈμ λ°λμͺ½μμλ λͺ¨λ μ μ μ λ°νν©λλ€. λ°λΌμ νλΈμ μ€μ¬μ μ 2 ** n μ μ μ λͺ¨λ λ°ννκ³ μΆμ λ°λΌ ν λ¨μλ₯Ό μ€μ¬μμ λ©μ΄μ§λ©΄ μ μ μκ° μ λ°μΌλ‘ μ€μ΄ λλλ€.
4 면체 ν¨λ°λ¦¬μ λ§μ°¬κ°μ§λ‘ λΉ λ°°μ΄ λ°°μ΄μ μμ±νμ¬ μμνμ¬ μμ λΉ μ μ μμ λ°λΌ μ± μλλ€. κΌμ§μ μ μλ κ°μ₯μ리,λ©΄, νλΈ λ±μ λ°λΌ μ¬λΌκ° λ 2 ** nλ§νΌ λ€μνλ―λ‘ log2(s.size)+1
κ°λ¨ν λμ μ¬μ© ν©λλ€ s.size
. λ€μ ν¨μμμ 볡κ·νκΈ° μ μ νμ΄νΌ νλΈ μ체μ κΌμ§μ μ΄ 2 κ° λ―Έλ§μΈ λͺ¨λ μμλ₯Ό ββμ κ±°ν΄μΌν©λλ€.
8 면체 / μ§κ΅ μ΄μ€ ν¨λ°λ¦¬λ νλΈ ν¨λ°λ¦¬μ μ΄μ€ 체μ΄λ―λ‘ λ€μ 3**n
μΉ΄νλ‘κ·Έ ν νλͺ© μ΄ μμ΅λλ€. μ¬κΈ°μ μ°λ¦¬ -1,0,1
λ λͺ¨λ μ°¨μμ λν΄ λ°λ³΅ νκ³ μ μ μ 0μ΄ μλ μ’νκ° ν΄λΉ μ μ ν΄λΉ μ’νμ κ°μΌλ©΄ ν΄λΉ μ μ ν΄λΉνλ λͺ©λ‘μ μ μ μ΄ μΆκ°λ©λλ€. λ°λΌμ λͺ¨μ리λ 0μ΄ μλ μ’νκ° 2 κ°μΈ μ , μΌκ°νμ΄ 0μ΄ μλ μ’νκ°μλ μ , 4 λ©΄μ²΄κ° 0μ΄ μλ μ μ μ΄μλ μ (4d 곡κ°)μ ν΄λΉν©λλ€.
κ° μ μ λν κ²°κ³Ό μ μ λ°°μ΄μ λ€λ₯Έ κ²½μ°μ κ°μ΄ ν° λ°°μ΄μ μ μ₯λλ―λ‘ λ°ννκΈ° μ μ μ μ μ΄ 2 κ° λ―Έλ§μΈ μμλ₯Ό μ κ±°ν΄μΌν©λλ€. κ·Έλ¬λμ΄ κ²½μ° μκ³ λ¦¬μ¦μ΄ κΈ°λ‘νμ§ μκΈ° λλ¬Έμ μ 체 λΆλͺ¨ n-topeμ μ κ±° ν νμκ° μμ΅λλ€.
νλΈμ μ½λ ꡬνμ κ°λ₯ν ν μ μ¬νκ² μ€κ³λμμ΅λλ€. μ΄κ²μ μ΄λ€ μ°μν¨μ κ°μ§κ³ μμ§λ§, λμΌν μ리μ κΈ°λ°νλ³΄λ€ ν¨μ¨μ μΈ μκ³ λ¦¬μ¦μ΄ κ³ μ λ μ μμ΅λλ€.
https://en.wikipedia.org/wiki/Hypercube
http://mathworld.wolfram.com/Hypercube.html
https://ko.wikipedia.org/wiki/Cross-polytope
http://mathworld.wolfram.com/CrossPolytope.html
3D νΉμ μ¬λ‘μ λν ν μ΄λΈ μμ± μ½λ
λ§μ§λ§ μΉμμ νν ν 5 μ€ λμΉ μΆμΌλ‘ μ μ΄μ 면체 / μμ΄ λ©΄μ²΄λ₯Ό κ°λ λ°©ν₯μ΄ μ¬μ©λμμΌλ©°, μ΄λ λΆνμ κ°μ₯ μΌκ΄λ λΌλ²¨λ§μ μν΄ λ§λ€μ΄μ‘μ΅λλ€. μ μ΄μ 면체μ μ μ κ³Όλ©΄μ λ²νΈλ μ½λ μ£Όμμ λ€μ΄μ΄κ·Έλ¨μ λ°λ₯΄λ©° 12 면체μ κ²½μ°μλ λ°λμ λλ€.
https://en.wikipedia.org/wiki/Regular_icosahedron μ λ°λ₯΄λ©΄ μ μ΄μ 면체μ 10 κ°μ λΉκ·Ήμ± μ μ μ μλλ +/- arctan (1/2)μ λλ€ μ μ΄μ 면체μ 첫 10 κ°μ μ μ μ μ’νλ μ΄κ²μ xy νλ©΄μΌλ‘λΆν° +/- 2 거리μμλ λ°κ²½ 2μ λ μμ μμ΅λλ€. μ΄λ κ²νλ©΄ μ 체 λ°κ²½μ΄ sqrt (5)μ λλ€. λ§μ§λ§ λ μ μ μ΄ (0,0, + /-sqrt (2))μ μμ΅λλ€.
μ μμ΄ λ©΄μ²΄μ μ μ μ μ’νλ κ·Έκ²λ€μ λλ¬μΈλ 3 면체 μ μ μ μ’νλ₯Ό ν©ν¨μΌλ‘μ¨ κ³μ°λλ€.
=begin
TABLE NAMES vertices edges faces
icosahedron vv ee ff
dodecahedron uu aa bb
10
/ \ / \ / \ / \ / \
/10 \ /12 \ /14 \ /16 \ /18 \
-----1-----3-----5-----7-----9
\ 0 / \ 2 / \ 4 / \ 6 / \ 8 / \
\ / 1 \ / 3 \ / 5 \ / 7 \ / 9 \
0-----2-----4-----6-----8-----
\11 / \13 / \15 / \17 / \19 /
\ / \ / \ / \ / \ /
11
=end
vv=[];ee=[];ff=[]
10.times{|i|
vv[i]=[2*sin(PI/5*i),2*cos(PI/5*i),(-1)**i]
ee[i]=[i,(i+1)%10];ee[i+10]=[i,(i+2)%10];ee[i+20]=[i,11-i%2]
ff[i]=[(i-1)%10,i,(i+1)%10];ff[i+10]=[(i-1)%10,10+i%2,(i+1)%10]
}
vv+=[[0,0,-5**0.5],[0,0,5**0.5]]
uu=[];aa=[];bb=[]
10.times{|i|
uu[i]=(0..2).map{|j|vv[ff[i][0]][j]+vv[ff[i][1]][j]+vv[ff[i][2]][j]}
uu[i+10]=(0..2).map{|j|vv[ff[i+10][0]][j]+vv[ff[i+10][1]][j]+vv[ff[i+10][2]][j]}
aa[i]=[i,(i+1)%10];aa[i+10]=[i,(i+10)%10];aa[i+20]=[(i-1)%10+10,(i+1)%10+10]
bb[i]=[(i-1)%10+10,(i-1)%10,i,(i+1)%10,(i+1)%10+10]
}
bb+=[[10,12,14,16,18],[11,13,15,17,19]]
4d νΉμ μ¬λ‘μ λν ν μ΄λΈμ μμ±νκΈ°μν μ½λ
μ΄κ²μ μ½κ°μ ν΄νΉμ λλ€. μ΄ μ½λλ μ€ννλ λ° λͺ μ΄κ° 걸립λλ€. μΆλ ₯μ νμΌμ μ μ₯νκ³ νμμ λ°λΌλ‘λνλ κ²μ΄ μ’μ΅λλ€.
600 μ μ λν 120 κ°μ μ μ μ’ν λͺ©λ‘μ http://mathworld.wolfram.com/600-Cell.htmlμ μμ΅λλ€. ν©κΈ λΉμ¨μ νΉμ§μΌλ‘νμ§ μλ 24 κ°μ μ μ μ’νλ 24 μ μ μ μ μ νμ±ν©λλ€. Wikipediaμ ꡬμ±μ λμΌνμ§λ§μ΄ 24 κ°μ μ’νμ λ€λ₯Έ 96 κ°μ μλμ μΈ λ°°μ¨μ μ€λ₯κ° μμ΅λλ€.
#TABLE NAMES vertices edges faces cells
#600 cell (analogue of icosahedron) v e f g
#120 cell (analogue of dodecahedron) u x y z
#24 cell o p q r
#600-CELL
# 120 vertices of 600cell. First 24 are also vertices of 24-cell
v=[[2,0,0,0],[0,2,0,0],[0,0,2,0],[0,0,0,2],[-2,0,0,0],[0,-2,0,0],[0,0,-2,0],[0,0,0,-2]]+
(0..15).map{|j|[(-1)**(j/8),(-1)**(j/4),(-1)**(j/2),(-1)**j]}+
(0..95).map{|i|j=i/12
a,b,c,d=1.618*(-1)**(j/4),(-1)**(j/2),0.618*(-1)**j,0
h=[[a,b,c,d],[b,a,d,c],[c,d,a,b],[d,c,b,a]][i%12/3]
(i%3).times{h[0],h[1],h[2]=h[1],h[2],h[0]}
h}
#720 edges of 600cell. Identified by minimum distance of 2/phi between them
e=[]
120.times{|i|120.times{|j|
e<<[i,j] if i<j && ((v[i][0]-v[j][0])**2+(v[i][1]-v[j][1])**2+(v[i][2]-v[j][2])**2+(v[i][3]-v[j][3])**2)**0.5<1.3
}}
#1200 faces of 600cell.
#If 2 edges share a common vertex and the other 2 vertices form an edge in the list, it is a valid triangle.
f=[]
720.times{|i|720.times{|j|
f<< [e[i][0],e[i][1],e[j][1]] if i<j && e[i][0]==e[j][0] && e.index([e[i][1],e[j][1]])
}}
#600 cells of 600cell.
#If 2 triangles share a common edge and the other 2 vertices form an edge in the list, it is a valid tetrahedron.
g=[]
1200.times{|i|1200.times{|j|
g<< [f[i][0],f[i][1],f[i][2],f[j][2]] if i<j && f[i][0]==f[j][0] && f[i][1]==f[j][1] && e.index([f[i][2],f[j][2]])
}}
#120 CELL (dual of 600 cell)
#600 vertices of 120cell, correspond to the centres of the cells of the 600cell
u=g.map{|i|s=[0,0,0,0];i.each{|j|4.times{|k|s[k]+=v[j][k]/4.0}};s}
#1200 edges of 120cell at centres of faces of 600-cell. Search for pairs of tetrahedra with common face
x=f.map{|i|s=[];600.times{|j|s<<j if i==(i & g[j])};s}
#720 pentagonal faces, surrounding edges of 600-cell. Search for sets of 5 tetrahedra with common edge
y=e.map{|i|s=[];600.times{|j|s<<j if i==(i & g[j])};s}
#120 dodecahedral cells surrounding vertices of 600-cell. Search for sets of 20 tetrahedra with common vertex
z=(0..119).map{|i|s=[];600.times{|j|s<<j if [i]==([i] & g[j])};s}
#24-CELL
#24 vertices, a subset of the 600cell
o=v[0..23]
#96 edges, length 2, found by minimum distances between vertices
p=[]
24.times{|i|24.times{|j|
p<<[i,j] if i<j && ((v[i][0]-v[j][0])**2+(v[i][1]-v[j][1])**2+(v[i][2]-v[j][2])**2+(v[i][3]-v[j][3])**2)**0.5<2.1
}}
#96 triangles
#If 2 edges share a common vertex and the other 2 vertices form an edge in the list, it is a valid triangle.
q=[]
96.times{|i|96.times{|j|
q<< [p[i][0],p[i][1],p[j][1]] if i<j && p[i][0]==p[j][0] && p.index([p[i][1],p[j][1]])
}}
#24 cells. Calculates the centre of the cell and the 6 vertices nearest it
r=(0..23).map{|i|a,b=(-1)**i,(-1)**(i/2)
c=[[a,b,0,0],[a,0,b,0],[a,0,0,b],[0,a,b,0],[0,a,0,b],[0,0,a,b]][i/4]
s=[]
24.times{|j|t=v[j]
s<<j if (c[0]-t[0])**2+(c[1]-t[1])**2+(c[2]-t[2])**2+(c[3]-t[3])**2<=2
}
s}
https://ko.wikipedia.org/wiki/600-cell
http://mathworld.wolfram.com/600-Cell.html
https://ko.wikipedia.org/wiki/120-cell
http://mathworld.wolfram.com/120-Cell.html
https://ko.wikipedia.org/wiki/24-cell
http://mathworld.wolfram.com/24-Cell.html
μ¬μ© λ° μΆλ ₯ μ
cell24 = polytope[[3,4,3]]
puts "vertices"
cell24[0].each{|i|p i}
puts "edges"
cell24[1].each{|i|p i}
puts "faces"
cell24[2].each{|i|p i}
puts "cells"
cell24[3].each{|i|p i}
vertices
[2, 0, 0, 0]
[0, 2, 0, 0]
[0, 0, 2, 0]
[0, 0, 0, 2]
[-2, 0, 0, 0]
[0, -2, 0, 0]
[0, 0, -2, 0]
[0, 0, 0, -2]
[1, 1, 1, 1]
[1, 1, 1, -1]
[1, 1, -1, 1]
[1, 1, -1, -1]
[1, -1, 1, 1]
[1, -1, 1, -1]
[1, -1, -1, 1]
[1, -1, -1, -1]
[-1, 1, 1, 1]
[-1, 1, 1, -1]
[-1, 1, -1, 1]
[-1, 1, -1, -1]
[-1, -1, 1, 1]
[-1, -1, 1, -1]
[-1, -1, -1, 1]
[-1, -1, -1, -1]
edges
[0, 8]
[0, 9]
[0, 10]
[0, 11]
[0, 12]
[0, 13]
[0, 14]
[0, 15]
[1, 8]
[1, 9]
[1, 10]
[1, 11]
[1, 16]
[1, 17]
[1, 18]
[1, 19]
[2, 8]
[2, 9]
[2, 12]
[2, 13]
[2, 16]
[2, 17]
[2, 20]
[2, 21]
[3, 8]
[3, 10]
[3, 12]
[3, 14]
[3, 16]
[3, 18]
[3, 20]
[3, 22]
[4, 16]
[4, 17]
[4, 18]
[4, 19]
[4, 20]
[4, 21]
[4, 22]
[4, 23]
[5, 12]
[5, 13]
[5, 14]
[5, 15]
[5, 20]
[5, 21]
[5, 22]
[5, 23]
[6, 10]
[6, 11]
[6, 14]
[6, 15]
[6, 18]
[6, 19]
[6, 22]
[6, 23]
[7, 9]
[7, 11]
[7, 13]
[7, 15]
[7, 17]
[7, 19]
[7, 21]
[7, 23]
[8, 9]
[8, 10]
[8, 12]
[8, 16]
[9, 11]
[9, 13]
[9, 17]
[10, 11]
[10, 14]
[10, 18]
[11, 15]
[11, 19]
[12, 13]
[12, 14]
[12, 20]
[13, 15]
[13, 21]
[14, 15]
[14, 22]
[15, 23]
[16, 17]
[16, 18]
[16, 20]
[17, 19]
[17, 21]
[18, 19]
[18, 22]
[19, 23]
[20, 21]
[20, 22]
[21, 23]
[22, 23]
faces
[0, 8, 9]
[0, 8, 10]
[0, 8, 12]
[0, 9, 11]
[0, 9, 13]
[0, 10, 11]
[0, 10, 14]
[0, 11, 15]
[0, 12, 13]
[0, 12, 14]
[0, 13, 15]
[0, 14, 15]
[1, 8, 9]
[1, 8, 10]
[1, 8, 16]
[1, 9, 11]
[1, 9, 17]
[1, 10, 11]
[1, 10, 18]
[1, 11, 19]
[1, 16, 17]
[1, 16, 18]
[1, 17, 19]
[1, 18, 19]
[2, 8, 9]
[2, 8, 12]
[2, 8, 16]
[2, 9, 13]
[2, 9, 17]
[2, 12, 13]
[2, 12, 20]
[2, 13, 21]
[2, 16, 17]
[2, 16, 20]
[2, 17, 21]
[2, 20, 21]
[3, 8, 10]
[3, 8, 12]
[3, 8, 16]
[3, 10, 14]
[3, 10, 18]
[3, 12, 14]
[3, 12, 20]
[3, 14, 22]
[3, 16, 18]
[3, 16, 20]
[3, 18, 22]
[3, 20, 22]
[4, 16, 17]
[4, 16, 18]
[4, 16, 20]
[4, 17, 19]
[4, 17, 21]
[4, 18, 19]
[4, 18, 22]
[4, 19, 23]
[4, 20, 21]
[4, 20, 22]
[4, 21, 23]
[4, 22, 23]
[5, 12, 13]
[5, 12, 14]
[5, 12, 20]
[5, 13, 15]
[5, 13, 21]
[5, 14, 15]
[5, 14, 22]
[5, 15, 23]
[5, 20, 21]
[5, 20, 22]
[5, 21, 23]
[5, 22, 23]
[6, 10, 11]
[6, 10, 14]
[6, 10, 18]
[6, 11, 15]
[6, 11, 19]
[6, 14, 15]
[6, 14, 22]
[6, 15, 23]
[6, 18, 19]
[6, 18, 22]
[6, 19, 23]
[6, 22, 23]
[7, 9, 11]
[7, 9, 13]
[7, 9, 17]
[7, 11, 15]
[7, 11, 19]
[7, 13, 15]
[7, 13, 21]
[7, 15, 23]
[7, 17, 19]
[7, 17, 21]
[7, 19, 23]
[7, 21, 23]
cells
[0, 1, 8, 9, 10, 11]
[1, 4, 16, 17, 18, 19]
[0, 5, 12, 13, 14, 15]
[4, 5, 20, 21, 22, 23]
[0, 2, 8, 9, 12, 13]
[2, 4, 16, 17, 20, 21]
[0, 6, 10, 11, 14, 15]
[4, 6, 18, 19, 22, 23]
[0, 3, 8, 10, 12, 14]
[3, 4, 16, 18, 20, 22]
[0, 7, 9, 11, 13, 15]
[4, 7, 17, 19, 21, 23]
[1, 2, 8, 9, 16, 17]
[2, 5, 12, 13, 20, 21]
[1, 6, 10, 11, 18, 19]
[5, 6, 14, 15, 22, 23]
[1, 3, 8, 10, 16, 18]
[3, 5, 12, 14, 20, 22]
[1, 7, 9, 11, 17, 19]
[5, 7, 13, 15, 21, 23]
[2, 3, 8, 12, 16, 20]
[3, 6, 10, 14, 18, 22]
[2, 7, 9, 13, 17, 21]
[6, 7, 11, 15, 19, 23]