5D Library › 黄历择吉布尔格、建除十二直同余与卢恩符文组合学 · English
第八章 黄历应用的审计与一项预注册检验
常见失误的计数
黄历或卢恩应用,可以按它自称遵循的规则来核查。常见的失误有四种:循环十二神而不做重复日,在 1 月 1 日换年,在农历新年而不是立春换年(干支纪年的岁首是立春),以及按错误的时区计算节气。
推导
# Chapter 8. p15: Auditing an almanac app against the rules. For 2027,
# the number of days on which a common slip changes the officer or the
# year-breaker mark, against a correct Beijing-time computation:
# (a) a plain 12-day officer cycle with no repeat days; (b) the year
# branch changed on 1 January instead of at Lichun (4 February); (c) the
# year branch changed at the lunar new year (6 February 2027); (d) the
# jie computed for UTC-8 instead of Beijing time.
import datetime
OFFICERS = ("jian chu man ping ding zhi po wei cheng shou kai bi").split()
# the 12 "jie" of 2027, Beijing time (UTC+8), from NAOJ's 2027 table
JIE = ((1, 5, 22, 10), (2, 4, 9, 46), (3, 6, 3, 40), (4, 5, 8, 17),
(5, 6, 1, 25), (6, 6, 5, 26), (7, 7, 15, 37), (8, 8, 1, 27),
(9, 8, 4, 28), (10, 8, 20, 17), (11, 7, 23, 39), (12, 7, 16, 38))
D0 = datetime.date(2027, 1, 1) # geng-chen day, mansion Gui (22)
def days(offset_h=0):
"""One dict per day of 2027: stem, branch, month and year branch."""
jie = [datetime.datetime(2027, m, d, h, mi) +
datetime.timedelta(hours=offset_h) for m, d, h, mi in JIE]
out = []
for k in range(365):
day = D0 + datetime.timedelta(days=k)
n = sum(1 for j in jie if j.date() <= day) # jie passed
gz = (16 + k) % 60
out.append({"date": day, "gz": gz, "s": gz % 10, "b": gz % 12,
"M": n % 12, "Y": 6 if n < 2 else 7,
"mansion": (22 + k) % 28})
return out
def officer(d):
return (d["b"] - d["M"]) % 12
def breaker(d, Y):
return d["b"] == (Y + 6) % 12
if __name__ == "__main__":
ds = days()
off = [officer(d) for d in ds]
plain = [(off[0] + k) % 12 for k in range(365)]
print(" (a) no repeat days: officer wrong on {} days".format(
sum(1 for x, y in zip(plain, off) if x != y)))
jan = sum(1 for d in ds if breaker(d, d["Y"]) != breaker(d, 7))
moved = sum(1 for d in ds if d["Y"] != 7)
print(" (b) year from 1 January: {} days in the wrong year, year"
.format(moved))
print(" breaker wrong on {} days".format(jan))
cny = datetime.date(2027, 2, 6)
lny = sum(1 for d in ds if breaker(d, d["Y"]) !=
breaker(d, 6 if d["date"] < cny else 7))
moved = sum(1 for d in ds if d["Y"] != (6 if d["date"] < cny else 7))
print(" (c) year from lunar new year: {} days in the wrong year,"
.format(moved))
print(" year breaker wrong on {} days".format(lny))
west = [officer(d) for d in days(-16)]
print(" (d) UTC-8 jie: officer wrong on {} days".format(
sum(1 for x, y in zip(west, off) if x != y)))
# (a) no repeat days: officer wrong on 336 days
# (b) year from 1 January: 34 days in the wrong year, year
# breaker wrong on 6 days
# (c) year from lunar new year: 2 days in the wrong year,
# year breaker wrong on 0 days
# (d) UTC-8 jie: officer wrong on 8 days2027 年,简单循环有 336 天出错。在 1 月 1 日换年,有 34 天被算进错误的年份,其中 6 天的岁破判错。在农历新年(2027 年 2 月 6 日)换年,有 2 天被算进错误的年份,在 2027 年对岁破无害,但并非每年如此。按 UTC-8 计算节气,有 8 天的值神出错。
检验通书需要什么
推导
# Chapter 8. p16: What it would take to test an almanac claim, and a
# rune set. (1) Do small businesses opened on an almanac "good" day
# survive two years more often? Base survival 0.70; sample size per arm
# to detect +5 or +10 points (two-sided alpha 0.05, power 0.80). (2) With
# 10 almanac schools tested at alpha 0.05 each, the chance that at least
# one "works" by luck. (3) Is a rune bag fair? Each draw is one single
# rune taken at random from the full bag, its orientation recorded, and
# the rune returned before the next draw (independent draws with
# replacement). Draws needed to tell a reversal share of 0.36 from the
# exact 0.3125. Both sample sizes use the same two-sided test: alpha 0.05
# split over two tails, quantile z(1 - alpha/2), power 0.80.
import math
from statistics import NormalDist
Z = NormalDist().inv_cdf
def n_two(p1, p2, alpha=0.05, power=0.80):
pb = (p1 + p2) / 2
num = (Z(1 - alpha / 2) * math.sqrt(2 * pb * (1 - pb)) +
Z(power) * math.sqrt(p1 * (1 - p1) + p2 * (1 - p2)))
return math.ceil(num ** 2 / (p1 - p2) ** 2)
def n_one(p0, p1, alpha=0.05, power=0.80):
# one-sample test of a proportion, two-sided like n_two above
num = (Z(1 - alpha / 2) * math.sqrt(p0 * (1 - p0)) +
Z(power) * math.sqrt(p1 * (1 - p1)))
return math.ceil(num ** 2 / (p1 - p0) ** 2)
if __name__ == "__main__":
for lift in (0.05, 0.10):
print(" survival 0.70 -> {:.2f}: {:,} businesses per arm".format(
0.70 + lift, n_two(0.70, 0.70 + lift)))
print(" 10 schools, at least one false positive: {:.3f}".format(
1 - 0.95 ** 10))
print(" with Bonferroni (alpha 0.005 each): {:.3f}".format(
1 - 0.995 ** 10))
print(" rune bag, single runes drawn with replacement,")
print(" reversal share 0.3125 vs 0.36 (two-sided): {:,} draws".format(
n_one(0.3125, 0.36)))
# survival 0.70 -> 0.75: 1,251 businesses per arm
# survival 0.70 -> 0.80: 294 businesses per arm
# 10 schools, at least one false positive: 0.401
# with Bonferroni (alpha 0.005 each): 0.049
# rune bag, single runes drawn with replacement,
# reversal share 0.3125 vs 0.36 (two-sided): 764 draws要检验在通书吉日开业的小企业两年存活率是否更高,若基准存活率为 0.70,检出升到 0.75 需要每组 1,251 家,升到 0.80 需要 294 家。在通常的显著性水平下检验 10 个流派,至少有一个出现虚假「成功」的概率是 0.401;用邦费罗尼校正后为 0.049。卢恩袋也可以检验:要把 0.36 的逆位比例与精确值 0.3125 区分开,需要记录 764 次抽取。这里每次抽取都是从整袋中随机取出单枚符文、记下正逆后放回,再抽下一次,即独立的有放回抽取;检验与上面的开业比较一样采用双侧检验,显著性水平 0.05,检验力 0.80。
注
黄历与卢恩应用的四步核查。 第一,按自己所在地点,用干支与节气重算值神,并核对十二个重复日(p03、p04)。第二,问清楚应用计入哪些规则、怎样排序;两个诚实的应用可以在半年里意见相左(p02、p14)。第三,对短时间窗内的请求,接受它可能没有完全无凶的答案(p07)。第四,在卢恩应用中,检查九个对称符文从不显示为逆位,并且大约 0.3125 的符文以逆位出现(p09)。
假说 · 尚未验证
预注册预测(尚未验证): 在每组至少 1,251 家小企业的记录中,控制行业与年份之后,通书吉日开业者与其他日子开业者的两年存活率相差不超过 5 个百分点。什么会证明它错: 吉日开业的存活率高出 5 个百分点以上,并且在按所检验的流派数校正后仍然显著。
全书小结
通书规则是布尔谓词;七组规则叠加后,2027 年只剩 0.090 的日子是纯吉日,比例大致按单条规则比例的乘积下降(p01);由相同成分构成的两个流派,一致程度几乎不超过偶然(p02)。建除十二神是一个在十二个节重复的同余式,交节日取决于时区(p03、p04)。干支日与星宿有 420 天的联合周期,一个日期的判定不能从一年带到下一年(p05、p06)。短时间窗常常无解,而大多数日子既吉又凶(p07、p08)。24 个符文中只有 15 个可以逆位,所以逆位服从超几何-二项复合分布,每个符文的逆位均值是 0.3125,而不是二分之一(p09 至 p12)。睡虎地《日书》已并列两套系统,任何标记排序都决定了一年中的大部分日子,《高人的箴言》没有提到逆位的卢恩(p13、p14)。
Fan, Y. (2026). Almanac Auspicious Boolean Lattices, Jianchu Twelve-Officer Congruences and Runic Combinatorics: Constraint Satisfaction Paradoxes, Solar-Term Phase Jumps and Elder Futhark Inversion Distributions [黄历择吉布尔格、建除十二直同余与卢恩符文组合学] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090239 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).