关于「两个排盘引擎与一套测试向量」,《四柱排盘的计算》给出的定量结论是什么?

结论:第六章比较两个排盘引擎:钟表时间与 23 点换日对真太阳时与零点换日,在上海对 0.1043 的出生、在吉隆坡对 0.6463 的出生至少一柱不同,并给出一套测试向量与指纹。

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

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.1043, 0.6463

   city           day pillar  hour pillar  any pillar
   Shanghai          0.0379      0.0674      0.1043
   Beijing           0.0520      0.1252      0.1668
   Singapore         0.0869      0.5432      0.5801
   Kuala Lumpur      0.0929      0.6143      0.6463
Reading: in Shanghai the two engines disagree on about one
birth in ten; in Kuala Lumpur and Singapore on more than half.
Most disagreements are in the hour pillar; the day pillar
differs for four to nine births in a hundred, around midnight.
查看完整验算程序
# Chapter 6. Two engines, one birth: how often do the pillars differ?
# Engine X reads the clock (UTC+8) and changes the day at 23:00 (rule A
# of p03). Engine Y converts to true solar time (longitude and the
# equation of time, as in p04) and changes the day at midnight with the
# late-zi stem rule (rule B). Year and month pillars depend only on the
# instant of birth and are the same in both. Every minute of 2026 is
# taken as an equally likely birth time.
import math

CITIES = (("Shanghai", 121.47), ("Beijing", 116.40),
          ("Singapore", 103.82), ("Kuala Lumpur", 101.69))
JDN_2026 = 2461042                      # 1 January 2026

def equation_of_time(n):
    g = 2 * math.pi / 365 * (n - 1)
    return 229.18 * (0.000075 + 0.001868 * math.cos(g)
                     - 0.032077 * math.sin(g) - 0.014615 * math.cos(2 * g)
                     - 0.040849 * math.sin(2 * g))

def pillars(day_idx, minute, rule):
    hb = ((minute + 60) // 120) % 12
    late = minute >= 23 * 60
    d = day_idx + (1 if late and rule == "A" else 0)
    stem_day = day_idx + (1 if late else 0)
    return d % 60, (2 * (stem_day % 10 % 5) + hb) % 10, hb

if __name__ == "__main__":
    print("   city           day pillar  hour pillar  any pillar")
    for name, lon in CITIES:
        day = hour = anyp = total = 0
        for n in range(365):
            di = (JDN_2026 + n + 49) % 60
            off = 4 * (lon - 120) + equation_of_time(n + 1)
            for t in range(1440):
                x = pillars(di, t, "A")
                ts = t + off
                dj = di
                if ts < 0:
                    ts, dj = ts + 1440, di - 1
                elif ts >= 1440:
                    ts, dj = ts - 1440, di + 1
                y = pillars(dj, int(ts), "B")
                day += x[0] != y[0]
                hour += x[1:] != y[1:]
                anyp += x != y
                total += 1
        print("   {:12s}    {:8.4f}    {:8.4f}    {:8.4f}".format(
            name, day / total, hour / total, anyp / total))
    print("\nReading: in Shanghai the two engines disagree on about one")
    print("birth in ten; in Kuala Lumpur and Singapore on more than half.")
    print("Most disagreements are in the hour pillar; the day pillar")
    print("differs for four to nine births in a hundred, around midnight.")

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《四柱排盘的历法计算与规则引擎》第 6 章「两个排盘引擎与一套测试向量」(版本 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090180

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

BibTeX
@book{fan2026066,
  author    = {Fan, Yafu},
  title     = {Four-Pillar Calendrical Computation and Formal Rule Engines},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  doi       = {10.5281/zenodo.24090180},
  url       = {https://doi.org/10.5281/zenodo.24090180}
}

本书其他章节结论