5D Library › 纳甲装卦与奇门遁甲排盘的组合计算 · English
第四章 地盘与天盘:二面体群与外圈旋转
地盘
定局之后,三奇六仪按戊、己、庚、辛、壬、癸、丁、丙、乙的次序布到九宫:阳遁从局数所在之宫起戊,依洛书数序一、二、三……顺布;阴遁逆布 (Ho 2003)。中五宫与其他宫一样得一个符号,读盘时寄于坤二宫。
推导
# Chapter 4. The earth plate: 18 layouts that form the dihedral group.
# The nine symbols wu ji geng xin ren gui ding bing yi (six "yi" and
# three "qi") are laid on the nine palaces in Luoshu number order: in a
# yang bureau b, wu goes to palace b and each later symbol to the next
# palace (b, b+1, ...); in a yin bureau, to the previous one (b, b-1,
# ...), modulo 9 with 0 written as 9. Palace 5, the centre, takes a
# symbol like any other ("lodged" in Kun 2 when read).
from itertools import permutations
SYMBOLS = ("wu", "ji", "geng", "xin", "ren", "gui", "ding", "bing", "yi")
def nine(x):
return (x - 1) % 9 + 1
def layout(b, yang):
"""palace of each symbol, as a tuple indexed by symbol 0..8"""
return tuple(nine(b + k) if yang else nine(b - k) for k in range(9))
def compose(p, q):
"""apply q, then p, to palace labels 1..9 seen as positions"""
return tuple(p[q[k] - 1] for k in range(9))
if __name__ == "__main__":
plates = {(b, y): layout(b, y) for b in range(1, 10) for y in (1, 0)}
print(" yang 1: " + " ".join("{}:{}".format(s, p) for s, p in
zip(SYMBOLS, plates[1, 1])))
print(" yin 9: " + " ".join("{}:{}".format(s, p) for s, p in
zip(SYMBOLS, plates[9, 0])))
print(" distinct layouts: {} of 18".format(len(set(plates.values()))))
# as maps on the nine positions: x -> b + x (yang), b - x (yin)
maps = {tuple(nine(b + (x - 1)) if y else nine(b - (x - 1))
for x in range(1, 10)) for b in range(1, 10)
for y in (1, 0)}
closed = all(compose(p, q) in maps for p in maps for q in maps)
print(" the 18 maps are closed under composition: {}".format(closed))
rot = sum(1 for m in maps if len(set(nine(m[x] - x - 1)
for x in range(9))) == 1)
print(" rotations: {}; reflections: {}".format(rot, 18 - rot))
n_all = sum(1 for _ in permutations(range(9)))
print(" arrangements of nine symbols on nine palaces: {:,d}".format(
n_all))
print("\nReading: the earth plate uses 18 of the 362,880 possible")
print("arrangements: the nine rotations (yang bureaus) and nine")
print("reflections (yin bureaus) of the Luoshu cycle, the dihedral")
print("group of order 18.")
# yang 1: wu:1 ji:2 geng:3 xin:4 ren:5 gui:6 ding:7 bing:8 yi:9
# yin 9: wu:9 ji:8 geng:7 xin:6 ren:5 gui:4 ding:3 bing:2 yi:1
# distinct layouts: 18 of 18
# the 18 maps are closed under composition: True
# rotations: 9; reflections: 9
# arrangements of nine symbols on nine palaces: 362,880
#
# Reading: the earth plate uses 18 of the 362,880 possible
# arrangements: the nine rotations (yang bureaus) and nine
# reflections (yin bureaus) of the Luoshu cycle, the dihedral
# group of order 18.阳遁 局把第 个符号放在 宫,阴遁放在 宫(模 9)。这是九个位置上的平移与反射:18 个地盘恰好是阶为 18 的二面体群 ,九个阳遁局是旋转,九个阴遁局是反射,彼此复合仍在其中。九个符号排到九宫共有 362,880 种方式,地盘只用到其中 18 种。
天盘:外圈八宫的旋转
天盘由九星带着地盘的符号旋转而成。外圈八宫按坎一、艮八、震三、巽四、离九、坤二、兑七、乾六的次序围成一圈,九星各以同数之宫为本宫,中五的天禽随坤二的天芮。每一时辰,旬首(甲子戊、甲戌己、甲申庚、甲午辛、甲辰壬、甲寅癸)在地盘的宫位决定值符之星;值符移到时干在地盘的宫位(甲时用旬首之仪),外圈八星随之整体转动。于是天盘只是外圈的八种旋转之一。
推导
# Chapter 4. The heaven plate as a rotation of the outer ring.
# The eight outer palaces in ring order: 1, 8, 3, 4, 9, 2, 7, 6. The
# nine stars sit at home on the palace of the same number (Peng 1,
# Rui 2, Chong 3, Fu 4, Qin 5, Xin 6, Zhu 7, Ren 8, Ying 9); Qin in the
# centre travels with Rui. For hour k of a bureau (0 = jia-zi), the
# decade's leading symbol (jia-zi wu, jia-xu ji, jia-shen geng, jia-wu
# xin, jia-chen ren, jia-yin gui) marks the palace of the duty star; the
# duty star moves to the earth-plate palace of the hour stem (jia hours
# use the leading symbol), and all eight outer stars turn with it.
# A centre palace counts as Kun 2. Fu yin: no turn; fan yin: half turn.
SYMBOLS = ("wu", "ji", "geng", "xin", "ren", "gui", "ding", "bing", "yi")
STEMS = ("jia", "yi", "bing", "ding", "wu", "ji", "geng", "xin", "ren",
"gui")
RING = (1, 8, 3, 4, 9, 2, 7, 6)
LEADER = ("wu", "ji", "geng", "xin", "ren", "gui")
def nine(x):
return (x - 1) % 9 + 1
def earth(b, yang):
return {s: nine(b + k) if yang else nine(b - k)
for k, s in enumerate(SYMBOLS)}
def outer(p):
return 2 if p == 5 else p
def star_turn(b, yang, k):
e = earth(b, yang)
lead = LEADER[k // 10]
stem = STEMS[k % 10]
src = outer(e[lead])
dst = outer(e[lead if stem == "jia" else stem])
return (RING.index(dst) - RING.index(src)) % 8
if __name__ == "__main__":
turns = [star_turn(b, y, k) for b in range(1, 10) for y in (1, 0)
for k in range(60)]
n = len(turns)
print(" {:,d} bureau-hours".format(n))
print(" turn of the heaven plate in eighths (turn:count):")
print(" " + " ".join("{}:{}".format(r, turns.count(r))
for r in range(8)))
print(" fu yin (no turn): {:.4f}".format(turns.count(0) / n))
print(" fan yin (half turn): {:.4f}".format(turns.count(4) / n))
jia = sum(1 for b in range(1, 10) for y in (1, 0) for k in range(60)
if k % 10 == 0)
print(" jia hours, always fu yin: {} = {:.4f}".format(jia, jia / n))
print("\nReading: the heaven plate only turns the outer ring, so each")
print("chart is one of eight rotations. Fu yin is not rare: besides")
print("every jia hour it occurs whenever the leading symbol and the")
print("hour stem both fall on Kun 2 or the centre.")
# 1,080 bureau-hours
# turn of the heaven plate in eighths (turn:count):
# 0:240 1:120 2:120 3:120 4:120 5:120 6:120 7:120
# fu yin (no turn): 0.2222
# fan yin (half turn): 0.1111
# jia hours, always fu yin: 108 = 0.1000
#
# Reading: the heaven plate only turns the outer ring, so each
# chart is one of eight rotations. Fu yin is not rare: besides
# every jia hour it occurs whenever the leading symbol and the
# hour stem both fall on Kun 2 or the centre.在 18 局乘 60 时辰的 1,080 个局时中,天盘不转(伏吟)的有 240 个,占 0.2222;转半圈(反吟)的有 120 个,占 0.1111;其余六种转法各 120 个。甲时总是伏吟,占 0.1000;另外的伏吟来自旬首之仪与时干一个在中宫、一个在坤二,两者都按坤二计。所以伏吟比「只在甲时」常见一倍多,这是中五寄坤的规则造成的。
小结
地盘是二面体群 :九个旋转与九个反射,只占九个符号全部排列中的 18 种。天盘是外圈八宫的旋转;伏吟占全部局时的 0.2222,反吟占 0.1111,伏吟中有一半以上不是甲时,而来自中五寄坤。
参考文献
Fan, Y. (2026). Najia Hexagram Encoding and Qimen Dunjia Combinatorial Engines: Eight-Palace Group Actions, Sexagenary Void Cosets, Split-Supplement versus Intercalation Divergences and Nine-Palace Rotor Permutations [纳甲装卦与奇门遁甲排盘的组合计算] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090182 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).