5D Library › Najia Hexagram Encoding and Qimen Dunjia Combinatorial Engines · 中文

Chapter 4. Earth Plate and Heaven Plate: a Dihedral Group and a Ring Rotation

The earth plate

Once the bureau is fixed, the six yi and three qi are laid out on the nine palaces in the order wu, ji, geng, xin, ren, gui, ding, bing, yi: in yang dun wu goes on the palace of the bureau number and the rest follow forward in Luoshu number order, one, two, three …; in yin dun they go backward (Ho 2003). The centre palace 5 takes a symbol like any other and is read as lodged in Kun 2.

Calculation

# 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.
The nine palaces and the order of the outer ring (gold arrows: Kan 1, Gen 8, Zhen 3, Xun 4, Li 9, Kun 2, Dui 7, Qian 6); in the cells, the earth plate of yang bureau 1.

Yang bureau bb puts the kk-th symbol on palace b+kb + k, yin bureau bb on palace b−kb – k (modulo 9). These are translations and reflections of nine positions: the 18 earth plates are exactly the dihedral group D9D_9 of order 18, the nine yang bureaus its rotations and the nine yin bureaus its reflections, closed under composition. Nine symbols can be laid on nine palaces in 362,880 ways, of which the earth plate uses 18.

The heaven plate: a rotation of the outer ring

The heaven plate is made by the nine stars turning with the symbols of the earth plate. The eight outer palaces form a ring in the order Kan 1, Gen 8, Zhen 3, Xun 4, Li 9, Kun 2, Dui 7, Qian 6; each star’s home is the palace of its number, and Tian Qin of the centre travels with Tian Rui of Kun 2. In each double-hour, the earth-plate palace of the decade’s leading symbol (jia-zi wu, jia-xu ji, jia-shen geng, jia-wu xin, jia-chen ren, jia-yin gui) fixes the duty star; the duty star moves to the earth-plate palace of the hour stem (a jia hour uses the leading symbol), and the eight outer stars turn with it as a whole. The heaven plate is thus one of eight rotations of the outer ring.

Calculation

# 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.

Of the 1,080 bureau-hours (18 bureaus times 60 double-hours), the heaven plate does not turn (fu yin) in 240, 0.2222; it turns half way round (fan yin) in 120, 0.1111; each of the six other turns occurs 120 times. Jia hours are always fu yin, 0.1000; the other cases of fu yin come from the leading symbol and the hour stem lying one in the centre and one in Kun 2, both counted as Kun 2. Fu yin is therefore more than twice as common as “jia hours only” would make it, because of the rule that lodges the centre in Kun.

Summary

The earth plate is the dihedral group D9D_9: nine rotations and nine reflections, 18 of all the arrangements of nine symbols. The heaven plate is a rotation of the outer ring; fu yin takes 0.2222 of all bureau-hours and fan yin 0.1111, and more than half of the fu yin cases are not jia hours but come from lodging the centre in Kun.

References

Ho, Peng Yoke. 2003. Chinese Mathematical Astrology: Reaching out to the Stars. RoutledgeCurzon.

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).