关于「紫微斗数的安星法则是模 12 的映射」,《卦变与星宫的数学》给出的定量结论是什么?

结论:第五章把命宫、五行局与安紫微星诀写成模 12 的分段仿射映射:天府是紫微关于寅申轴的反射,十四主星只有 12 种排布。

数据口径:书中以标注框区分已发表的证据、可运行的 Python 计算(16 段程序)、原典与作者的假说。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 与结论吻合的打印值: 12

   Life palace over 144 month-hour pairs: each branch [12] times
   example month 3, hour Chen: Life in Zi, Body in Shen
   Life Zi, Spouse Xu, Wealth Shen, Travel Wu, Career Chen, Fortune Yin
   opposite (Travel) = L + 6; Wealth = L - 4 = L + 8; Career = L - 8 = L + 4
   bureau by year stem (Jia/Ji .. Wu/Gui) and Life branch:
   stem 0  2 2 6 6 3 3 5 5 4 4 6 6
   stem 1  6 6 5 5 4 4 3 3 2 2 5 5
   stem 2  5 5 3 3 2 2 4 4 6 6 3 3
   stem 3  3 3 4 4 6 6 2 2 5 5 4 4
   stem 4  4 4 2 2 5 5 6 6 3 3 2 2
   bureau counts over the 60 cells: 2: 12, 3: 12, 4: 12, 5: 12, 6: 12
Reading: the Life and Body palaces are affine maps mod 12 of
month and hour, each branch equally often. The bureau is a table
look-up (the na yin cycle of the sixty stem-branch pairs); each
year stem gives its own pattern, and over the 60 cells each of
the five bureaus occurs exactly 12 times.

核心公式

\[L = (2 + (m-1) - h) \bmod 12, \qquad B = (2 + (m-1) + h) \bmod 12 .\]
查看完整验算程序
# Chapter 5. Zi Wei Dou Shu: the Life Palace and the "element bureau".
# Branches are numbered 0..11 (Zi, Chou, Yin, ... Hai); stems 0..9 (Jia ..
# Gui). Birth month m (1..12, lunar) and birth hour h (0 = Zi .. 11 = Hai).
#   Life palace   start at Yin (2) as month 1, count forward to month m,
#                 then backward to hour h:   L = (2 + (m - 1) - h) mod 12
#   Body palace   forward instead:           (2 + (m - 1) + h) mod 12
#   12 palaces    Life, Siblings, Spouse, Children, Wealth, Health,
#                 Travel, Friends, Career, Property, Fortune, Parents at
#                 L, L - 1, ..., L - 11 (counted backward)
#   palace stems  the stem on Yin is 2 (year stem mod 5) + 2 (mod 10) - the
#                 "five tigers" rule of Book 37 - and stems run on from Yin
#   bureau        the na yin element of the Life palace's stem-branch pair
#                 gives the bureau: water 2, wood 3, metal 4, earth 5, fire 6
BRANCH = "Zi Chou Yin Mao Chen Si Wu Wei Shen You Xu Hai".split()
PALACES = ("Life Siblings Spouse Children Wealth Health Travel Friends "
           "Career Property Fortune Parents").split()
NAYIN = "metal fire wood earth metal fire water earth metal wood " \
        "water earth fire wood water".split() * 2   # 30 pairs of the 60
BUREAU = {"water": 2, "wood": 3, "metal": 4, "earth": 5, "fire": 6}

def life(m, h):
    return (2 + (m - 1) - h) % 12

def body(m, h):
    return (2 + (m - 1) + h) % 12

def stem_of(branch, year_stem):
    yin_stem = (2 * (year_stem % 5) + 2) % 10
    return (yin_stem + (branch - 2) % 12) % 10

def sexagenary(stem, branch):
    for k in range(60):
        if k % 10 == stem and k % 12 == branch:
            return k
    raise ValueError("stem and branch of different parity")

def bureau(year_stem, life_branch):
    k = sexagenary(stem_of(life_branch, year_stem), life_branch)
    return BUREAU[NAYIN[k // 2]]

if __name__ == "__main__":
    counts = [0] * 12
    for m in range(1, 13):
        for h in range(12):
            counts[life(m, h)] += 1
    print("   Life palace over 144 month-hour pairs: each branch {} times"
          .format(sorted(set(counts))))
    m, h = 3, 4
    L = life(m, h)
    print("   example month 3, hour Chen: Life in {}, Body in {}".format(
        BRANCH[L], BRANCH[body(m, h)]))
    print("   " + ", ".join("{} {}".format(PALACES[i], BRANCH[(L - i) % 12])
                          for i in range(0, 12, 2)))
    print("   opposite (Travel) = L + 6; Wealth = L - 4 = L + 8;"
          " Career = L - 8 = L + 4")
    tally = {}
    print("\n   bureau by year stem (Jia/Ji .. Wu/Gui) and Life branch:")
    for ys in range(5):
        row = [bureau(ys, b) for b in range(12)]
        for v in row:
            tally[v] = tally.get(v, 0) + 1
        print("   stem {}  ".format(ys) + " ".join(str(v) for v in row))
    print("   bureau counts over the 60 cells: " + ", ".join(
        "{}: {}".format(k, tally[k]) for k in sorted(tally)))
    print("\nReading: the Life and Body palaces are affine maps mod 12 of")
    print("month and hour, each branch equally often. The bureau is a table")
    print("look-up (the na yin cycle of the sixty stem-branch pairs); each")
    print("year stem gives its own pattern, and over the 60 cells each of")
    print("the five bureaus occurs exactly 12 times.")

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《六维超立方体游走、卦变马尔可夫链与模运算星宫晶格》第 5 章「紫微斗数的安星法则是模 12 的映射」(版本 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090176

DOI: 10.5281/zenodo.24090176 · 阅读本章所在专著 · 5DL-B-064 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026064,
  author    = {Fan, Yafu},
  title     = {Six-Dimensional Hypercube Walks, Hexagram Mutation Markov Chains and Modular Star-Palace Lattices},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  doi       = {10.5281/zenodo.24090176},
  url       = {https://doi.org/10.5281/zenodo.24090176}
}

本书其他章节结论