νƒœκ·Έ 보관물: math

math

SchlΓ€fli 볼둝 μ •κΈ° 폴리 ν† ν”„ 톡역 λ‚˜νƒ€λ‚Ό 수 μžˆμŠ΅λ‹ˆλ‹€. ν¬μ§€ν‹°λΈŒ

λ°°κ²½

슐래 ν”Œλ¦¬ κΈ°ν˜ΈλŠ” 일반 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을 μ œκ³΅ν•©λ‹ˆλ‹€.

채점

μ£Όμ œμ— λŒ€ν•œ μ§ˆλ¬Έμ„ μœ μ§€ν•˜κΈ° μœ„ν•΄ μ½”λ“œ κ³¨ν”„λ‘œ κ°œμ •λ˜μ—ˆμŠ΅λ‹ˆλ‹€. κ°€μž₯ 짧은 μ½”λ“œκ°€ μŠΉλ¦¬ν•©λ‹ˆλ‹€.

이 μ§ˆλ¬Έμ— λŒ€ν•œ githubκ°€ μž‘μ„±λ˜μ—ˆμŠ΅λ‹ˆλ‹€



λ‹΅λ³€

파이썬

νŠΉλ³„ν•œ κ²½μš°κ°€μ—†λŠ” μž¬κ·€ ν”„λ‘œκ·Έλž¨μ΄ μžˆμŠ΅λ‹ˆλ‹€. 빈 쀄과 주석을 λ¬΄μ‹œ ν•˜κ³ , λ§ˆμ§€λ§‰μ— 였일러 곡식을 μ κ²€ν•˜λŠ” 것을 ν¬ν•¨ν•˜μ—¬ 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 μ°¨μ›μ—μ„œ κ°€μž₯ κ°€κΉŒμš΄ μœ μ‚¬μ²΄λŠ” μœ‘λ©΄μ²΄μ™€ κ·Έ 이쀑 λ§ˆλ¦„λͺ¨κΌ΄ 십이 면체).

μ£Όμš” κΈ°λŠ₯

λ‹€μŒμ€ polytopeschlafi 기호λ₯Ό 해석 ν•˜λŠ” μ£Όμš” κΈ°λŠ₯μž…λ‹ˆλ‹€. 숫자 배열을 μ˜ˆμƒν•˜κ³  λ‹€μŒκ³Ό 같이 μ—¬λŸ¬ 배열을 ν¬ν•¨ν•˜λŠ” 배열을 λ°˜ν™˜ν•©λ‹ˆλ‹€.

  • λͺ¨λ“  μ •μ μ˜ λ°°μ—΄λ‘œ, 각각 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κ³Ό -1s 의 λ°°μ—΄λ‘œ ν‘œν˜„λ˜λŠ” 꼭짓점이 μžˆμŠ΅λ‹ˆλ‹€ (λͺ¨λ“  κ°€λŠ₯성이 ν—ˆμš©λ©λ‹ˆλ‹€). λͺ¨λ“  정점 λͺ©λ‘μ˜ 색인 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]

λ‹΅λ³€