5D Library › 多模态历法张量融合、模九十谐波拨盘与跨系统共振诊断 · English

第一章 称骨:四张查表之和

称骨是什么样的算法

民间流传的「称骨」法,把出生的年、月、日、时各查一张表,得到四个以「两」「钱」计的重量,相加得到总重,再按总重查一首歌诀。四张表分别是:六十甲子年各一个重量,农历十二个月各一个,农历三十天各一个,十二个时辰各一个。程序所用的表与通行表一致(年表按六十甲子排列,以甲子为首,例如 1984 年)。

从数学上看,这是一个可分离的查表和:总重 = 年 + 月 + 日 + 时,四项互不影响。若把出生的年、月、日、时都看成均匀分布,总重的分布就是四张表各自分布的卷积。

可达的总重

推导

# Chapter 1. [p01] Bone weight (chen gu) as a sum of four lookup tables.
# Weights in qian (10 qian = 1 liang). Year by sexagenary index
# (0 = jia-zi, e.g. 1984), lunar month 1..12, lunar day 1..30,
# double-hour zi..hai. Tables as commonly circulated. The total is a
# sum of four independent lookups; under uniform year, month, day and
# hour we count the reachable totals, their distribution, and the
# totals named in the verse list (2.1 .. 7.2 liang) that no birth hits.
import math
from collections import Counter

YEAR = (12, 9, 6, 7, 12, 5, 9, 8, 7, 8, 15, 9, 16, 8, 8, 19, 12, 6,
        8, 7, 5, 15, 6, 16, 15, 7, 9, 12, 10, 7, 15, 6, 5, 14, 14, 9,
        7, 7, 9, 12, 8, 7, 13, 5, 14, 5, 9, 17, 5, 7, 12, 8, 8, 6,
        19, 6, 8, 16, 10, 7)
MONTH = (6, 7, 18, 9, 5, 16, 9, 15, 18, 8, 9, 5)
DAY = (5, 10, 8, 15, 16, 15, 8, 16, 8, 16, 9, 17, 8, 17, 10, 8, 9,
       18, 5, 15, 10, 9, 8, 9, 15, 18, 7, 8, 16, 6)
HOUR = (16, 6, 7, 10, 9, 16, 10, 8, 8, 9, 6, 6)

def totals():
    c = Counter()
    for y in YEAR:
        for m in MONTH:
            for d in DAY:
                for h in HOUR:
                    c[y + m + d + h] += 1
    return c

if __name__ == "__main__":
    c = totals()
    n = sum(c.values())
    lo, hi = min(c), max(c)
    print("   births (year x month x day x hour): {:,d}".format(n))
    print("   reachable totals: {} values, {:.1f} to {:.1f} liang".format(
        len(c), lo / 10, hi / 10))
    mode = max(c, key=c.get)
    print("   most common total {:.1f} liang, share {:.4f}".format(
        mode / 10, c[mode] / n))
    h = -sum(v / n * math.log2(v / n) for v in c.values())
    print("   entropy {:.3f} bits (of log2 {} = {:.3f} if all equal)"
          .format(h, len(c), math.log2(len(c))))
    verse = range(21, 73)
    missing = [t for t in verse if t not in c]
    print("   verse totals never reached: " + ", ".join(
        "{:.1f}".format(t / 10) for t in missing))
    print("   heaviest entries: year {:.1f}, month {:.1f}, day {:.1f},"
          " hour {:.1f} liang".format(max(YEAR) / 10, max(MONTH) / 10,
                                      max(DAY) / 10, max(HOUR) / 10))
    edge = sum(v for t, v in c.items() if t <= 25 or t >= 65) / n
    print("   share of births at 2.5 liang or less, or 6.5 or more: {:.4f}"
          .format(edge))
    print("\nReading: the 60 x 12 x 30 x 12 births fall on only 51 totals,")
    print("bunched in the middle; the extremes the verses dwell on are")
    print("rare, and the last verse cannot be reached with these tables.")
#    births (year x month x day x hour): 259,200
#    reachable totals: 51 values, 2.1 to 7.1 liang
#    most common total 3.9 liang, share 0.0537
#    entropy 5.030 bits (of log2 51 = 5.672 if all equal)
#    verse totals never reached: 7.2
#    heaviest entries: year 1.9, month 1.8, day 1.8, hour 1.6 liang
#    share of births at 2.5 liang or less, or 6.5 or more: 0.0146
#
# Reading: the 60 x 12 x 30 x 12 births fall on only 51 totals,
# bunched in the middle; the extremes the verses dwell on are
# rare, and the last verse cannot be reached with these tables.
称骨总重的分布(虚线为歌诀中的「七两二钱」)。

60 × 12 × 30 × 12 = 259,200 种出生只落在 51 种总重上,从 2.1 两到 7.1 两;最常见的是 3.9 两,占 0.0537。分布的熵是 5.030 比特,低于 51 种总重均匀分布时的 5.672 比特:总重集中在中间。在 2.5 两及以下或 6.5 两及以上的出生只占 0.0146。

常见的说法是称骨总重在二两一钱到七两二钱之间。可是在这四张表下,年表最重 1.9 两,月表与日表最重各 1.8 两,时表最重 1.6 两,合计最多 7.1 两:「七两二钱」这一档,任何出生都无法达到。若要使它可以达到,至少有一张表与通行表不同。

谁决定了总重,时辰差一格会怎样

推导

# Chapter 1. [p02] Which component carries the bone weight, and how
# fragile is it at the edge of a double-hour? The four lookups are
# independent under uniform births, so the variance of the total is the
# sum of the four table variances. Then: a birth time uncertain by one
# double-hour (the neighbouring hour, either side, equally likely):
# the share of births whose total changes, and the mean size of the
# change. Tables of p01, in qian.
YEAR = (12, 9, 6, 7, 12, 5, 9, 8, 7, 8, 15, 9, 16, 8, 8, 19, 12, 6,
        8, 7, 5, 15, 6, 16, 15, 7, 9, 12, 10, 7, 15, 6, 5, 14, 14, 9,
        7, 7, 9, 12, 8, 7, 13, 5, 14, 5, 9, 17, 5, 7, 12, 8, 8, 6,
        19, 6, 8, 16, 10, 7)
MONTH = (6, 7, 18, 9, 5, 16, 9, 15, 18, 8, 9, 5)
DAY = (5, 10, 8, 15, 16, 15, 8, 16, 8, 16, 9, 17, 8, 17, 10, 8, 9,
       18, 5, 15, 10, 9, 8, 9, 15, 18, 7, 8, 16, 6)
HOUR = (16, 6, 7, 10, 9, 16, 10, 8, 8, 9, 6, 6)

def var(t):
    m = sum(t) / len(t)
    return sum((x - m) ** 2 for x in t) / len(t)

if __name__ == "__main__":
    parts = (("year", YEAR), ("month", MONTH), ("day", DAY),
             ("hour", HOUR))
    tot = sum(var(t) for _, t in parts)
    print("   component  mean (qian)  variance  share of total variance")
    for name, t in parts:
        print("   {:9s} {:12.3f} {:9.3f} {:23.3f}".format(
            name, sum(t) / len(t), var(t), var(t) / tot))
    print("   total variance {:.3f}, sd {:.3f} qian".format(tot, tot ** 0.5))
    pairs = [(HOUR[h], HOUR[(h + s) % 12]) for h in range(12)
             for s in (-1, 1)]
    changed = sum(a != b for a, b in pairs) / len(pairs)
    size = sum(abs(a - b) for a, b in pairs) / len(pairs)
    print("   one double-hour off: total changes for {:.4f} of births,"
          .format(changed))
    print("   by {:.3f} qian on average".format(size))
    print("\nReading: the month carries the largest share, then the day; the")
    print("hour carries less, yet a birth time off by one double-hour")
    print("changes the total for most births.")
#    component  mean (qian)  variance  share of total variance
#    year             9.683    14.550                   0.222
#    month           10.417    22.410                   0.342
#    day             11.300    17.543                   0.268
#    hour             9.250    11.021                   0.168
#    total variance 65.524, sd 8.095 qian
#    one double-hour off: total changes for 0.8333 of births,
#    by 3.667 qian on average
#
# Reading: the month carries the largest share, then the day; the
# hour carries less, yet a birth time off by one double-hour
# changes the total for most births.

四项相互独立,总重的方差就是四张表方差之和 65.524(以钱的平方计)。月份贡献最多(0.342),其次是日(0.268)、年(0.222),时辰最少(0.168)。但时辰最容易出错:若出生时间差了一个时辰(前后各半),0.8333 的出生总重会改变,平均改变 3.667 钱。十二个时辰中只有申、未(都是 8 钱)与戌、亥(都是 6 钱)两对相邻时辰重量相同。

假说 · 尚未验证

作者的诠释(尚未验证): 称骨的「信息量」大约是 5 比特,远低于四柱八字的组合数;作为一套报告的组成部分,它提供的是一个粗粒度的、集中在中间的分档,而不是个人化的细节。什么会证明这一判断错:若有另一套被广泛使用、并能考证来源的称骨表,其总重的熵显著高于 5 比特(例如通过更多的表项),本章的结论只适用于通行表。

小结

称骨是四张查表的可分离之和:259,200 种出生落在 51 种总重上,分布集中在中间,「七两二钱」在通行表下无法达到。总重的方差主要来自月份与日期,而时辰差一格就会使大多数出生的总重改变。

Fan, Y. (2026). Multimodal Calendrical Tensor Fusion, Modulo-90 Harmonic Dials and Cross-System Resonance Diagnostics: Climate-Balance Vectors, Flying-Transformation Matrices and Solar-Arc Midpoint Trees [多模态历法张量融合、模九十谐波拨盘与跨系统共振诊断] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090189 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).