5D Library › Najia Hexagram Encoding and Qimen Dunjia Combinatorial Engines · 中文
Chapter 8. A Budget of Conventions and a Pre-Registered Matching Test
Four questions before trusting a hexagram or Qimen program
This chapter turns the book into four questions that can be put to any six-line or Qimen program, the author’s own included. They are not advice on any decision.
1. Where do its tables come from? The eight palaces, the najia, the six spirits, the void branches and the bureau numbers can all be generated by closed forms (Chapters 1 to 3). A program should check its tables against the closed forms, not only copy them.
2. Which calendar and which pattern rules does it use? Split-supplement or intercalation (Chapter 3), which statement of the tomb rule (Chapter 6), clock time or true solar time for the double-hour (Volume 66).
3. How sensitive are its results to convention and to the moment? A program should report how the chart and its patterns change under another defensible convention, or when the moment moves into the neighbouring double-hour.
4. What does it describe? Whether a reading bears on the questioner’s situation must be measured by a blind matching test, not by an after-the-event rating of “accuracy” (Carlson 1985).
A budget of conventions
Setting out in one table the conventions on which two engines may differ, with the shares computed in earlier chapters, gives a “budget of conventions”.
Calculation
# Chapter 8. A convention budget for two Qimen engines.
# Each line is a choice two programs can make differently, with the share
# of bureau-hours it affects, as computed earlier in this book (p06 and
# p11) or in Volume 66 (true solar time, Shanghai and Kuala Lumpur). If
# the choices were independent, the share of hours on which two engines
# that differ in all of them show the same chart is the product of the
# shares unaffected.
BUDGET = (
("calendar: split-supplement vs intercalation", 0.3067), # p06
("tomb rule: common vs yang-dies", 0.1944), # p11
("hour from the clock vs true solar time, Shanghai", 0.069),
("hour from the clock vs true solar time, Kuala Lumpur", 0.610),
)
def same_share(shares):
out = 1.0
for s in shares:
out *= 1 - s
return out
if __name__ == "__main__":
for name, s in BUDGET:
print(" {:52s} {:.4f}".format(name, s))
for city, solar in (("Shanghai", BUDGET[2][1]),
("Kuala Lumpur", BUDGET[3][1])):
same = same_share((BUDGET[0][1], BUDGET[1][1], solar))
print(" {:12s}: engines differing in all three choices show"
.format(city))
print(" a different chart or verdict on {:.4f}"
" of hours".format(1 - same))
print("\nReading: before any question of meaning, two honest engines")
print("that make different but defensible choices disagree on about")
print("half of all hours in Shanghai and on most hours in Kuala Lumpur.")
# calendar: split-supplement vs intercalation 0.3067
# tomb rule: common vs yang-dies 0.1944
# hour from the clock vs true solar time, Shanghai 0.0690
# hour from the clock vs true solar time, Kuala Lumpur 0.6100
# Shanghai : engines differing in all three choices show
# a different chart or verdict on 0.4800 of hours
# Kuala Lumpur: engines differing in all three choices show
# a different chart or verdict on 0.7822 of hours
#
# Reading: before any question of meaning, two honest engines
# that make different but defensible choices disagree on about
# half of all hours in Shanghai and on most hours in Kuala Lumpur.The choice of calendar affects 0.3067 of double-hours, the tomb rule 0.1944 of bureau-hours, and clock against true solar time 0.0690 of double-hours in Shanghai and 0.6100 in Kuala Lumpur (Volume 66). If these choices were independent, two engines that differ in all three would give a different chart or verdict for 0.4800 of double-hours in Shanghai and 0.7822 in Kuala Lumpur. Independence is an approximation; its use is to show the order of magnitude: before any question of meaning, two honest engines that make different choices disagree on about half of all double-hours.
A pre-registered matching test
Hypothesis · not established
Study protocol. One complete engine (calendar, conversion to true solar time, pattern rules, the code that writes the readings) is registered publicly before recruitment and not changed afterwards. Participants record a question and the moment it is asked; an independent analyst writes three readings with the registered engine, one from the chart of that moment and two from charts of randomly chosen other bureau-hours. Later, without knowing which is which, the participant picks the one that best fits what actually happened. Primary outcome: the share who pick the reading of the true moment; one third if the readings carry no information. Test: one-sided exact binomial test, . The test is carried out by an independent analyst who has no financial relationship with the author and does not know where the readings came from, and the results are published whether positive or negative.
Calculation
# Chapter 8. A pre-registered matching test for Qimen readings.
# A participant records a question and the moment it is asked. An
# independent analyst writes three readings with one registered engine:
# one from the chart of that moment and two from charts of randomly
# chosen other bureau-hours; the participant, later and blind, picks the
# reading that best fits what happened. Chance hit rate 1/3.
from math import comb
def tail(n, k, p):
return sum(comb(n, i) * p ** i * (1 - p) ** (n - i)
for i in range(k, n + 1))
def plan(p0, p1, alpha=0.05, power=0.90):
for n in range(20, 5000):
k = next(k for k in range(n + 1) if tail(n, k, p0) <= alpha)
if tail(n, k, p1) >= power:
return n, k, tail(n, k, p0)
if __name__ == "__main__":
for p1 in (0.40, 0.45):
n, k, a = plan(1 / 3, p1)
print(" hit rate {:.2f} against 1/3, one-sided 0.05, power 0.90:"
.format(p1))
print(" {} participants, at least {} hits (exact size {:.4f})"
.format(n, k, a))
print("\nReading: a hit rate of 0.40 needs a few hundred participants,")
print("0.45 well under two hundred. The engine, its calendar and its")
print("pattern rules must be registered first, since by p15 a change")
print("of convention alone changes the chart for about half of hours.")
# hit rate 0.40 against 1/3, one-sided 0.05, power 0.90:
# 447 participants, at least 166 hits (exact size 0.0498)
# hit rate 0.45 against 1/3, one-sided 0.05, power 0.90:
# 152 participants, at least 61 hits (exact size 0.0468)
#
# Reading: a hit rate of 0.40 needs a few hundred participants,
# 0.45 well under two hundred. The engine, its calendar and its
# pattern rules must be registered first, since by p15 a change
# of convention alone changes the chart for about half of hours.Detecting a hit rate of 0.40 against one third with power 0.90 takes 447 participants and at least 166 hits (actual size 0.0498); if the true hit rate were 0.45, 152 participants and at least 61 hits would do. Moments of asking should be handled as Chapter 6 suggests: for questions asked near the boundary of a double-hour, the protocol must say in advance whether they are excluded or which double-hour is used.
Note
What the test tests, and what it does not. It tests whether a reading generated from the chart of the moment of asking fits the questioner’s situation better than readings generated from charts of other moments. It does not test the effect of choosing a time or of any decision. A negative result would not show that the help users feel from a reading is unreal; it would show only that the help does not depend on whether the chart is that of the moment of asking.
Summary
Before trusting a hexagram or Qimen program, ask whether its tables can be checked against closed forms, which calendar and pattern rules it uses, how sensitive its results are to convention and to the moment, and what it describes. A budget of conventions shows that two engines with different choices disagree on about half of all double-hours in Shanghai. A pre-registered matching test needs 447 participants to detect a hit rate of 0.40 against one third.
References
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).