5D Library › Six-Dimensional Hypercube Walks, Hexagram Mutation Markov Chains and Modular Star-Palace Lattices · 中文
Preface: The Finite Mathematics of Hexagrams and Star Palaces
Note
This is not divination and not advice on any decision; please read this first. The book studies the mathematical structure of the rules for casting a six-line hexagram and laying out a Zi Wei Dou Shu chart: the six-dimensional Boolean cube, Markov chains, probability, modular arithmetic and group actions. Its rules are taken from traditional divinatory arts, but the book neither claims nor tests that any reading comes true; Chapter 8 gives a design for testing that, not the result of a test. All data are generated by the programs printed in the book.
The six-line method and Zi Wei Dou Shu are both systems of rules that compute on finite sets. A hexagram is six binary digits, and the sixty-four hexagrams are the sixty-four vertices of the six-dimensional cube; casting samples these vertices, and changing lines walks on the cube. The twelve palaces of Zi Wei Dou Shu are the integers modulo 12, and the star-placement verses are maps from birth data to these integers. Such rules are exact mathematical objects in themselves: their probabilities, symmetries and losses of information can be computed, and what the computation gives is sometimes not what is commonly said.
Like the other books of 5D Library, it tries to refute before it sets bounds, and it reports negative results as they are.
What the book contains
Chapter 1 writes the sixty-four hexagrams as , the complementary and reversed hexagrams as group actions, and proves that the nuclear hexagram is a sliding-window map that shrinks everything to 4 hexagrams within two steps. Chapter 2 computes the probabilities of the yarrow-stalk and three-coin methods exactly, and tests whether “old yang is three times as likely as old yin” holds for different ways of splitting the stalks. Chapter 3 writes the change from the cast to the changed hexagram as a Markov chain on the cube and finds its spectral gap and stationary distribution. Chapter 4 computes the chance that each text is read under Zhu Xi’s rules for moving lines, and writes a good-or-bad judgement as a Boolean function on the cube. Chapter 5 writes the Life palace, the element bureau and the verse for placing the Zi Wei star as piecewise affine maps modulo 12. Chapter 6 writes “three sides and four squares” as a convolution on and tests how sensitive a matter-by-matter scoring algorithm is to its conventions. Chapter 7 reads the “number of the great expansion” in the Appended Statements, Zhu Xi’s divination procedure, Shao Yong’s Before-Heaven diagrams and the textual history of the Zi Wei Dou Shu alongside the models. Chapter 8 gives a four-step check and a pre-registered matching test.
The book borders on several others in 5D Library and recalls them briefly only where they overlap: Book 37 treated the modular arithmetic of the sexagenary calendar (including the “five tigers” rule) and Carlson’s double-blind test of astrology; Book 33 falsifiability and multiple testing; Book 62 the bilinear structure of chart matching and the hexagrams Xian and Heng.
Claims corrected after checking
- The nuclear hexagram does not end in four attractors. It folds the 64 hexagrams onto 16 (each image with exactly 4 preimages) and then onto 4; but of those 4 only Qian and Kun are fixed points, while Ji Ji and Wei Ji are each other’s nuclear hexagram, a 2-cycle (p02).
- “Old yang is three times as likely as old yin” depends on how the stalks are split. Under the usual assumption of equally likely remainders, old yang is 3/16 and old yin 1/16, exactly three times; with a binomial or near-even split it still holds to four decimal places; but if the split falls evenly over every possible position the ratio becomes 4.082 (p03, p04).
- The two methods give exactly the same distribution of moving lines. Each line moves with probability 1/4, and the chance of no moving line in six is 0.1780 under both; the cast hexagram is half yang under both; the difference is only in which lines move: under yarrow the changed hexagram’s lines are yang only 3/8 of the time (p03, p05).
- The change chains have the same spectral gap and different destinations. The Markov chain from cast to changed hexagram has spectral gap 1/2 under both methods; the coin chain is symmetric, the yarrow chain is not — Qian changes into Kun 729 times as often as Kun into Qian, and in its stationary distribution a line is yang only a quarter of the time (p06).
- Which text is read differs between the methods. Under Zhu Xi’s rules each rule is used with the same probability under both methods, but the distributions of the main text differ by 0.178; “use nine” is 729 times as likely as “use six” with yarrow, and equally likely with coins (p08).
- A good-or-bad score is a low-degree function on the cube. Counts of lines in their correct places and of resonating pairs have only first- and second-degree Fourier components, so the correlation between the cast and changed hexagrams’ scores is exactly 0.4167 (coins) (p09).
- The fourteen main stars have only 12 layouts. The Zi Wei placement verse is a piecewise affine map made of a quotient and a parity correction; Tian Fu is the reflection of Zi Wei across the Yin-Shen axis; every other main star is a fixed translation, so the fourteen main stars have only 12 possible layouts (p11).
- Weighting the three sides equally loses two thirds of the information. Adding a palace and its two trines with equal weights loses 8 of the 12 harmonics on ; adding the opposite palace with a different weight restores them all (p12).
- A score for a matter depends on its conventions. Two defensible sets of star values rank 144 cases with a rank correlation of only 0.606, order 0.264 of the pairs of cases oppositely, and share only 6 of their top ten (p13).
How to read the boxes
The boxes separate published evidence, runnable Python calculations (16 programs, standard library only, each actually run at build time with its real output printed beneath it), classical sources, notes and the author’s hypotheses; every hypothesis states what result would show it to be wrong.
Disclosure
The author uses the works of 5D Library, including this book, as the methodological basis of his community courses, the 5D Ascension Cards (Dimensional Shift Card Decks) and the Yafu AI knowledge base, and develops and runs paid online reading software and services built on traditional divinatory symbol systems (six-line hexagram casting, Zi Wei Dou Shu charts, chart matching and date selection); the models of this book are the mathematical basis of those programs’ algorithms, so he has a direct commercial interest in its subject. The book promotes no software, course, card deck or service, uses no user data from the author’s businesses, and accepts no sponsorship. All its models are offered for mathematical study and teaching only and constitute no promise of divinatory prediction and no advice on any decision. The test in Chapter 8 must be carried out with pre-registered code by an independent analyst who has no financial relationship with the author and does not know where the readings came from, and its results will be published whether positive or negative.
Fan, Y. (2026). Six-Dimensional Hypercube Walks, Hexagram Mutation Markov Chains and Modular Star-Palace Lattices: Boolean Cube Spectral Gaps, Yarrow-versus-Coin Probability Biases and Twelve-Palace Dihedral Projections [六维超立方体游走、卦变马尔可夫链与模运算星宫晶格] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090176 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).