File:Octeract Petrie polygon.svg
![File:Octeract Petrie polygon.svg](https://upload.wikimedia.org/wikipedia/commons/thumb/5/5f/Octeract_Petrie_polygon.svg/600px-Octeract_Petrie_polygon.svg.png?20160622202111)
原始檔案 (SVG 檔案,表面大小:2,100 × 2,100 像素,檔案大小:171 KB)
說明
說明
摘要
[編輯]描述Octeract Petrie polygon.svg |
![]() Petrie polygon graph of the 8-dimensional cube, the Hasse diagram of an 8 element set's power set Compare the Petrie polygon graph of the 4-dimensional cube: The colors represent the Walsh equivalence classes of 3-ary Boolean functions. Simpler Python code is shown in this file. It makes use of code created with the Python code below. |
||
來源 | 自己的作品 | ||
作者 |
|
||
其他版本 |
![]() |
![]() |
العربية ∙ جازايرية ∙ беларуская ∙ беларуская (тарашкевіца) ∙ български ∙ বাংলা ∙ català ∙ čeština ∙ Cymraeg ∙ Deutsch ∙ Schweizer Hochdeutsch ∙ Zazaki ∙ Ελληνικά ∙ English ∙ Esperanto ∙ español ∙ eesti ∙ euskara ∙ فارسی ∙ suomi ∙ français ∙ galego ∙ עברית ∙ हिन्दी ∙ hrvatski ∙ magyar ∙ հայերեն ∙ Bahasa Indonesia ∙ italiano ∙ 日本語 ∙ Jawa ∙ ქართული ∙ 한국어 ∙ kurdî ∙ Lëtzebuergesch ∙ lietuvių ∙ македонски ∙ മലയാളം ∙ मराठी ∙ Bahasa Melayu ∙ Nederlands ∙ Norfuk / Pitkern ∙ polski ∙ português ∙ português do Brasil ∙ rumantsch ∙ română ∙ русский ∙ sicilianu ∙ slovenčina ∙ slovenščina ∙ shqip ∙ српски / srpski ∙ svenska ∙ தமிழ் ∙ తెలుగు ∙ ไทย ∙ Tagalog ∙ Türkçe ∙ toki pona ∙ українська ∙ vèneto ∙ Tiếng Việt ∙ 中文 ∙ 中文(简体) ∙ 中文(繁體) ∙ +/− |
Source code
[編輯]Python and SVG source |
---|
from sympy import cos, pi
from math import log
from my.own.stuff import number_to_reverse_binary_list, hypercube_edges
import psycopg2
con = psycopg2.connect(host='lukulhuft', database='hupu', user='tupu', password='lupu')
cur = con.cursor()
bg_colors = ['fd0', 'e60000', 'bbb', '666', 'ffb4b4']
angle = pi / 16
a = cos(angle)
b = cos(3*angle)
c = cos(5*angle)
d = cos(7*angle)
directions = [
[-a, d], [-b, c], [-c, b], [-d, a], [d, a], [c, b], [b, c], [a, d]
] # directions of the 8 edges leaving the lowest vertex (as sympy objects)
big_factor = 1000 / (a + b + c + d) # diameter of the whole diagram shall be 2000
tiny_factor = 0.029 # the tiny dots in the vertices must be slightly off center
################################## vertices ##################################
sym_coordinates = [] # sympy objects
svg_coordinates = [] # rounded and converted to strings
svg_vertices = ''
svg_numbers = ''
for i in range(256):
cur.execute("""select wec from boolf3 where numval = %s""" % (i))
bg_color_index = cur.fetchone()[0] + 1 # from the DB comes a value between -1 and 3
bg_color = bg_colors[bg_color_index]
binary_vector = number_to_reverse_binary_list(i, 8)
x_sym = 0
y_sym = 0
for j in range(8):
if binary_vector[j]:
x_sym += directions[j][0]
y_sym += directions[j][1]
x_svg = str(round(big_factor * x_sym, 3))
y_svg = str(round(-big_factor * y_sym + 1000, 3))
sym_coordinates.append({'x': x_sym, 'y': y_sym})
svg_coordinates.append({'x': x_svg, 'y': y_svg})
svg_vertices += '<circle cx="%s" cy="%s" r="14.5" fill="#%s"/>' % (x_svg, y_svg, bg_color)
svg_numbers += '<text x="%s" y="%s">%s</text>' % (x_svg, y_svg, i)
################################## edges ##################################
svg_edges = ''
svg_tiny_dots = ''
edges = hypercube_edges(8)
for edge in edges: # ``edge`` is a pair of integers between 0 and 255
bottom = edge[0]
top = edge[1]
bottom_x_svg = svg_coordinates[bottom]['x']
bottom_y_svg = svg_coordinates[bottom]['y']
top_x_svg = svg_coordinates[top]['x']
top_y_svg = svg_coordinates[top]['y']
svg_edges += '<line x1="%s" y1="%s" x2="%s" y2="%s"/>' % (bottom_x_svg, bottom_y_svg, top_x_svg, top_y_svg)
edge_direction = directions[int(log(bottom ^ top, 2))]
tiny_edge_direction_x = tiny_factor * edge_direction[0]
tiny_edge_direction_y = tiny_factor * edge_direction[1]
bottom_x_sym = sym_coordinates[bottom]['x']
bottom_y_sym = sym_coordinates[bottom]['y']
top_x_sym = sym_coordinates[top]['x']
top_y_sym = sym_coordinates[top]['y']
bottom_tiny_x_sym = bottom_x_sym + tiny_edge_direction_x
bottom_tiny_y_sym = bottom_y_sym + tiny_edge_direction_y
top_tiny_x_sym = top_x_sym - tiny_edge_direction_x
top_tiny_y_sym = top_y_sym - tiny_edge_direction_y
bottom_tiny_x_svg = str(round(big_factor * bottom_tiny_x_sym, 3))
bottom_tiny_y_svg = str(round(-big_factor * bottom_tiny_y_sym + 1000, 3))
top_tiny_x_svg = str(round(big_factor * top_tiny_x_sym, 3))
top_tiny_y_svg = str(round(-big_factor * top_tiny_y_sym + 1000, 3))
svg_tiny_dots += '<circle cx="%s" cy="%s" r="1.8"/><circle cx="%s" cy="%s" r="1.8"/> ' % \
(bottom_tiny_x_svg, bottom_tiny_y_svg, top_tiny_x_svg, top_tiny_y_svg)
################################## file ##################################
svg_string = """<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="2100" height="2100" viewBox="-1050 -1050 2100 2100">
<!-- edges -->
<g style="stroke:#000; stroke-width:1.5; stroke-opacity:0.5;">
%s
</g>
<!-- vertices -->
<g style="stroke:#000; stroke-width:1.5px;">
%s
</g>
<!-- tiny dots -->
%s
<!-- numbers -->
<g style="text-anchor: middle; letter-spacing: -1;" font-size="10px" font-family="sans-serif" transform="translate(0, 3.7)" fill-opacity="0.5">
%s
</g>
</svg>
""" % (svg_edges, svg_vertices, svg_tiny_dots, svg_numbers)
svg_file = open('Octeract Petrie polygon.svg', 'w')
svg_file.write(svg_string)
|
授權條款
[編輯]![]() |
已授權您依據自由軟體基金會發行的無固定段落、封面文字和封底文字GNU自由文件授權條款1.2版或任意後續版本,對本檔進行複製、傳播和/或修改。該協議的副本列在GNU自由文件授權條款中。http://www.gnu.org/copyleft/fdl.htmlGFDLGNU Free Documentation Licensetruetrue |
![w:zh:共享創意](https://upload.wikimedia.org/wikipedia/commons/thumb/7/79/CC_some_rights_reserved.svg/90px-CC_some_rights_reserved.svg.png)
![姓名標示](https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Cc-by_new_white.svg/24px-Cc-by_new_white.svg.png)
- 您可以自由:
- 分享 – 複製、發佈和傳播本作品
- 重新修改 – 創作演繹作品
- 惟需遵照下列條件:
- 姓名標示 – 您必須指名出正確的製作者,和提供授權條款的連結,以及表示是否有對內容上做出變更。您可以用任何合理的方式來行動,但不得以任何方式表明授權條款是對您許可或是由您所使用。
檔案歷史
點選日期/時間以檢視該時間的檔案版本。
日期/時間 | 縮圖 | 尺寸 | 用戶 | 備註 | |
---|---|---|---|---|---|
目前 | 2016年6月22日 (三) 20:21 | ![]() | 2,100 × 2,100(171 KB) | Watchduck(對話 | 貢獻) | pointlessly tiny change |
2016年6月22日 (三) 19:07 | ![]() | 2,100 × 2,100(171 KB) | Watchduck(對話 | 貢獻) | clean code, colors for equivalence classes | |
2009年10月2日 (五) 23:58 | ![]() | 1,375 × 1,375(1,022 KB) | Watchduck(對話 | 貢獻) | ||
2009年10月2日 (五) 18:15 | ![]() | 1,488 × 1,488(1,022 KB) | Watchduck(對話 | 貢獻) | {{Information |Description={{en|1=Symmetrical central graph of the 8 dimensional cube (Octeract) and Hasse diagram of an 8 element sets power set. (Compare: [[:Image:Hypercubestar.svg|Central gr |
無法覆蓋此檔案。
檔案用途
下列64個頁面有用到此檔案:
- User:Watchduck/list
- User talk:Watchduck
- Commons:Quality images/Subject/Non photographic media
- Commons:Quality images candidates/Archives June 27 2016
- File:16x16 matrix like octeract Hasse diagram.svg
- File:3-ary Boolean functions in octeract graph; binary Walsh spectrum 0.svg
- File:3-ary Boolean functions in octeract graph; binary Walsh spectrum 1.svg
- File:3-ary Boolean functions in octeract graph; binary Walsh spectrum 2.svg
- File:3-ary Boolean functions in octeract graph; binary Walsh spectrum 3.svg
- File:3-ary Boolean functions in octeract graph; binary Walsh spectrum 4.svg
- File:3-ary Boolean functions in octeract graph; binary Walsh spectrum 5.svg
- File:3-ary Boolean functions in octeract graph; binary Walsh spectrum 6.svg
- File:3-ary Boolean functions in octeract graph; binary Walsh spectrum 7.svg
- File:8-cube.svg
- File:Boolean function 0000 0000.svg
- File:Boolean function 1111 1111.svg
- File:Boolean functions like 0110 1000.svg
- File:Boolean functions like 0110 1000 (minimal negation operator).svg
- File:Boolean functions like 0111 1110.svg
- File:Boolean functions like 1000 0000.svg
- File:Boolean functions like 1000 0001.svg
- File:Boolean functions like 1000 0010.svg
- File:Boolean functions like 1000 0100.svg
- File:Boolean functions like 1000 1000.svg
- File:Boolean functions like 1001 0000.svg
- File:Boolean functions like 1001 0110.svg
- File:Boolean functions like 1001 1000.svg
- File:Boolean functions like 1001 1001.svg
- File:Boolean functions like 1010 0000.svg
- File:Boolean functions like 1010 0100.svg
- File:Boolean functions like 1010 0101.svg
- File:Boolean functions like 1010 1000.svg
- File:Boolean functions like 1010 1001.svg
- File:Boolean functions like 1010 1010.svg
- File:Boolean functions like 1011 1000.svg
- File:Boolean functions like 1011 1100.svg
- File:Boolean functions like 1011 1110.svg
- File:Boolean functions like 1100 0000.svg
- File:Boolean functions like 1100 0010.svg
- File:Boolean functions like 1100 0011.svg
- File:Boolean functions like 1100 1000.svg
- File:Boolean functions like 1100 1001.svg
- File:Boolean functions like 1100 1010.svg
- File:Boolean functions like 1100 1100.svg
- File:Boolean functions like 1101 1010.svg
- File:Boolean functions like 1101 1110.svg
- File:Boolean functions like 1110 0000.svg
- File:Boolean functions like 1110 0001.svg
- File:Boolean functions like 1110 0100.svg
- File:Boolean functions like 1110 0110.svg
- File:Boolean functions like 1110 1000.svg
- File:Boolean functions like 1110 1001.svg
- File:Boolean functions like 1110 1001 (minimal negation operator).svg
- File:Boolean functions like 1110 1010.svg
- File:Boolean functions like 1110 1100.svg
- File:Boolean functions like 1110 1110.svg
- File:Boolean functions like 1111 0000.svg
- File:Boolean functions like 1111 0110.svg
- File:Boolean functions like 1111 1000.svg
- File:Boolean functions like 1111 1010.svg
- File:Boolean functions like 1111 1100.svg
- File:Boolean functions like 1111 1110.svg
- Template:3-ary Boolean functions; small equivalence classes; cubes
- Category:3-ary Boolean functions in octeract graph
全域檔案使用狀況
以下其他 wiki 使用了這個檔案:
- be.wikipedia.org 的使用狀況
- cv.wikipedia.org 的使用狀況
- en.wikipedia.org 的使用狀況
- en.wikiversity.org 的使用狀況
- eo.wikipedia.org 的使用狀況
- es.wikipedia.org 的使用狀況
- it.wikipedia.org 的使用狀況
- ro.wikipedia.org 的使用狀況
- sl.wikipedia.org 的使用狀況
- uk.wikipedia.org 的使用狀況
- zh.wikipedia.org 的使用狀況
詮釋資料
此檔案中包含其他資訊,這些資訊可能是由數位相機或掃描器在建立或數位化過程中所新增的。若檔案自原始狀態已被修改,一些詳細資料可能無法完整反映出已修改的檔案。
寬度 | 2100 |
---|---|
高度 | 2100 |