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

Chapter 5. The Human and Spirit Plates, and the Group the Plates Generate

The human and spirit plates

The eight doors have the same outer ring as their home: Xiu 1, Sheng 8, Shang 3, Du 4, Jing 9, Si 2, Jing 7, Kai 6. The door of the leading symbol’s palace is the duty door; from that palace it moves one palace per double-hour in Luoshu number order (forward in yang dun, backward in yin, counting the centre as Kun 2 when it passes through), and the eight doors turn with it as a whole. The eight spirits (Zhi Fu, Teng She, Tai Yin, Liu He, Bai Hu, Xuan Wu, Jiu Di, Jiu Tian) start from the duty star’s new palace, clockwise in yang dun and anticlockwise in yin, so the spirit plate has no freedom of its own: it is fixed by the turn of the heaven plate and the dun (Ho 2003).

Calculation

# Chapter 5. The human plate (doors), the spirits, and how many charts.
# Doors sit at home on the outer ring like the stars (Xiu 1, Sheng 8,
# Shang 3, Du 4, Jing 9, Si 2, Jing 7, Kai 6). The duty door is the door
# of the leading symbol's palace; it moves from there one palace per
# hour since the decade began, in Luoshu number order (forward in yang
# bureaus, backward in yin), through the centre if need be (counted as
# Kun 2), and all eight doors turn with it. The eight spirits start at
# the duty star's new palace and run round the ring, clockwise in yang
# bureaus and anticlockwise in yin: they add no freedom of their own.
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 outer(p):
    return 2 if p == 5 else p

def turns(b, yang, k):
    e = {s: nine(b + i) if yang else nine(b - i)
         for i, s in enumerate(SYMBOLS)}
    lead, stem, h = LEADER[k // 10], STEMS[k % 10], k % 10
    src = outer(e[lead])
    star = (RING.index(outer(e[lead if stem == "jia" else stem]))
            - RING.index(src)) % 8
    dest = nine(e[lead] + h) if yang else nine(e[lead] - h)
    door = (RING.index(outer(dest)) - RING.index(src)) % 8
    return star, door

if __name__ == "__main__":
    joint, charts = {}, set()
    for b in range(1, 10):
        for y in (1, 0):
            for k in range(60):
                s, d = turns(b, y, k)
                joint[s, d] = joint.get((s, d), 0) + 1
                charts.add((b, y, s, d))
    n = sum(joint.values())
    door = [sum(c for (s, d), c in joint.items() if d == r)
            for r in range(8)]
    print("   door turn in eighths (turn:count):")
    print("     " + " ".join("{}:{}".format(r, door[r]) for r in range(8)))
    print("   door fu yin {:.4f};  door fan yin {:.4f}".format(
        door[0] / n, door[4] / n))
    print("   (star turn, door turn) pairs that occur: {} of 64".format(
        len(joint)))
    both = joint.get((0, 0), 0)
    print("   star and door both fu yin: {:.4f}".format(both / n))
    print("   distinct charts (earth plate, star turn, door turn): {:,d}"
          .format(len(charts)))
    print("   of 1,080 bureau-hours; spirits add nothing, being fixed by")
    print("   the star turn and the dun")
    print("\nReading: the human plate is a second rotation of the same")
    print("ring, coupled to the first through the hour. The 1,080 bureau-")
    print("hours give only 727 distinct arrangements of the three plates:")
    print("different hours of one bureau can land on the same two turns,")
    print("and only the hour stem itself then tells them apart.")
#    door turn in eighths (turn:count):
#      0:240 1:120 2:120 3:120 4:120 5:120 6:120 7:120
#    door fu yin 0.2222;  door fan yin 0.1111
#    (star turn, door turn) pairs that occur: 64 of 64
#    star and door both fu yin: 0.1241
#    distinct charts (earth plate, star turn, door turn): 727
#    of 1,080 bureau-hours; spirits add nothing, being fixed by
#    the star turn and the dun
#
# Reading: the human plate is a second rotation of the same
# ring, coupled to the first through the hour. The 1,080 bureau-
# hours give only 727 distinct arrangements of the three plates:
# different hours of one bureau can land on the same two turns,
# and only the hour stem itself then tells them apart.

The turns of the door plate are distributed like those of the stars: no turn (door fu yin) 0.2222, half a turn (door fan yin) 0.1111. All 64 combinations of a star turn and a door turn occur; star and door both in fu yin 0.1241. Taking earth plate, star turn and door turn together, the 1,080 bureau-hours give only 727 distinct combinations of the three plates. Different double-hours of one bureau can land on the same two turns, and only the hour stem itself then tells them apart.

What group the plate moves generate

The earth plate is a translation or reflection of the Luoshu numbers; the heaven plate a rotation of the outer ring of eight palaces (the centre fixed). If these two kinds of move are composed freely, which arrangements of the nine positions can be reached?

Calculation

# Chapter 5. Which permutations of the nine palaces the plates generate.
# Earth plates are the dihedral maps x -> b + x and x -> b - x on the
# Luoshu numbers 1..9 (p07). The heaven plate turns the eight outer
# palaces round the ring 1, 8, 3, 4, 9, 2, 7, 6 and leaves the centre.
# A heaven-plate arrangement is "earth plate, then turn". We count the
# arrangements that charts actually use, and the size of the group that
# the two kinds of move generate inside S_9 (by closure).
RING = (1, 8, 3, 4, 9, 2, 7, 6)

def nine(x):
    return (x - 1) % 9 + 1

def dihedral(b, yang):
    return tuple(nine(b + x) if yang else nine(b - x) for x in range(9))

def turn(r):
    t = {p: RING[(RING.index(p) + r) % 8] for p in RING}
    t[5] = 5
    return t

def after(perm, t):
    return tuple(t[p] for p in perm)

def closure(gens):
    ident = tuple(range(1, 10))
    seen, frontier = {ident}, [ident]
    while frontier:
        nxt = []
        for g in frontier:
            for h in gens:
                c = tuple(h[x - 1] for x in g)
                if c not in seen:
                    seen.add(c)
                    nxt.append(c)
        frontier = nxt
    return seen

def parity(p):
    seen, odd = set(), 0
    for i in range(9):
        if i in seen:
            continue
        j, n = i, 0
        while j not in seen:
            seen.add(j)
            j, n = p[j] - 1, n + 1
        odd += (n - 1) % 2
    return odd % 2

if __name__ == "__main__":
    used = {after(dihedral(b, y), turn(r)) for b in range(1, 10)
            for y in (1, 0) for r in range(8)}
    half = all(after(dihedral(b, 1), turn(4)) == dihedral(nine(10 - b), 0)
               for b in range(1, 10))
    print("   arrangements: 18 earth plates x 8 turns = {} distinct".format(
        len(used)))
    shift = tuple(nine(x + 1) for x in range(1, 10))
    mirror = tuple(nine(10 - x) for x in range(1, 10))
    rho = tuple(turn(1)[x] for x in range(1, 10))
    g = closure([shift, mirror, rho])
    print("   yin plate of bureau 10 - b = yang plate of bureau b turned")
    print("   half way round the ring, for every b: {}".format(half))
    print("   group generated by the Luoshu shift, the mirror and one turn:")
    print("   order {:,d};  all of S_9 ({:,d}): {}".format(
        len(g), 362880, len(g) == 362880))
    print("   the turn is an {} permutation (an 8-cycle)".format(
        "odd" if parity(rho) else "even"))
    print("\nReading: composed freely, the two moves of the plates reach")
    print("every one of the 362,880 arrangements of nine symbols. Charts use")
    print("only 72 of them, because every yin earth plate is a yang plate")
    print("turned half way round: a tiny and highly structured subset.")
#    arrangements: 18 earth plates x 8 turns = 72 distinct
#    yin plate of bureau 10 - b = yang plate of bureau b turned
#    half way round the ring, for every b: True
#    group generated by the Luoshu shift, the mirror and one turn:
#    order 362,880;  all of S_9 (362,880): True
#    the turn is an odd permutation (an 8-cycle)
#
# Reading: composed freely, the two moves of the plates reach
# every one of the 362,880 arrangements of nine symbols. Charts use
# only 72 of them, because every yin earth plate is a yang plate
# turned half way round: a tiny and highly structured subset.

All of them: the Luoshu shift, the mirror and a one-step turn of the ring generate the whole symmetric group S9S_9 on the nine positions, 362,880 permutations. A one-step turn of the ring is an 8-cycle, an odd permutation, so the group cannot stay inside the alternating group of even permutations.

Charts, however, use only a tiny part of it. Eighteen earth plates times eight turns should make 144 heaven-plate arrangements, but there are only 72, because the earth plate of yin bureau 10−b10 – b equals the earth plate of yang bureau bb turned half way round; the program checks this for all nine bureaus. In other words, a yin earth plate is not a new arrangement, only the fan yin of a yang one.

Hypothesis · not established

The author’s conjecture (not yet tested): the property “a yin earth plate is a yang earth plate turned half way round” comes from the fact that opposite palaces of the outer ring add to ten (one and nine, eight and two, three and seven, four and six). The designers may have used this symmetry of the Luoshu on purpose, so that yin and yang dun share one structure on the plates. What would show it wrong: early texts showing that the order of the outer ring was chosen for reasons unrelated to symmetry (for example, a correspondence of directions and seasons) would make the property a mere by-product.

Summary

The human plate is a second rotation of the same ring, and the spirit plate has no freedom of its own. The 1,080 bureau-hours give only 727 distinct combinations of the three plates. Composed freely, the two plate moves generate the whole of S9S_9, but charts use only 72 heaven-plate arrangements of it, because every yin earth plate is a yang earth plate turned half way round.

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