What does Hexagram and Star-Palace Mathematics conclude, in numbers, about “"Three Sides and Four Squares" Is a Convolution on the Ring of Twelve Palaces”?
Answer: Chapter 6 writes "three sides and four squares" as a convolution on the ring of twelve palaces: equal trines lose 8 of 12 harmonics, and two defensible sets of star values rank 144 cases with a rank correlation of only 0.606.
Scope of the numbers: Marked boxes separate published evidence, runnable Python calculations (16 programs), classical sources and the author's hypotheses.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 0.606, 144
| cases scored | 144; distinct scores A 43, B 41 |
| Spearman rank correlation A vs B | 0.606 |
| pairs of cases ordered oppositely | 0.264 |
| top-10 cases shared | 6 of 10 |
| Reading: two conventions that a practitioner could defend | |
| agree broadly but not in detail: they order a sizeable share of | |
| pairs of months oppositely and share only part of their 'best | |
| months'. A score is exactly as definite as its conventions. |
Key formula
Show the full program
# Chapter 6. A numerical score for "seeking wealth this month" - and how
# much it depends on the conventions put into it.
# The score of a matter is a weighted sum of star values over the "three
# sides and four squares" of the matter's palace (kernel of p12: self 1,
# opposite 0.8, trines 0.5). For wealth the matter's palace is the Wealth
# palace, four places back from the flowing-month Life palace. Star
# values are a convention. Two plausible conventions are compared:
# A a general good/bad scale
# B a wealth-specific scale (Wu Qu and Tan Lang raised, Qi Sha and
# Po Jun softened, Tian Tong lowered)
# Over all 12 main-star layouts (p11) x 12 flowing-month Life palaces,
# the program scores the 144 cases under each convention and reports
# their Spearman rank correlation, the share of pairs of cases the two
# conventions order differently, and the overlap of their top 10 cases.
import math
from itertools import combinations
ZI = {"Zi Wei": 0, "Tian Ji": -1, "Tai Yang": -3, "Wu Qu": -4,
"Tian Tong": -5, "Lian Zhen": -8}
FU = {"Tian Fu": 0, "Tai Yin": 1, "Tan Lang": 2, "Ju Men": 3,
"Tian Xiang": 4, "Tian Liang": 5, "Qi Sha": 6, "Po Jun": 10}
A = {"Zi Wei": 2, "Tian Fu": 2, "Tai Yang": 1, "Tai Yin": 1,
"Tian Tong": 1, "Tian Liang": 1, "Tian Xiang": 1, "Wu Qu": 1,
"Tian Ji": 0.5, "Tan Lang": 0, "Lian Zhen": -0.5, "Ju Men": -1,
"Qi Sha": -1, "Po Jun": -1}
B = dict(A, **{"Wu Qu": 2, "Tan Lang": 1, "Qi Sha": 0, "Po Jun": -0.5,
"Tian Tong": 0})
KERNEL = {0: 1.0, 6: 0.8, 4: 0.5, 8: 0.5}
def layout(z):
f = (4 - z) % 12
out = {s: (z + o) % 12 for s, o in ZI.items()}
out.update({s: (f + o) % 12 for s, o in FU.items()})
return out
def score(z, life, values):
stars = layout(z)
wealth = (life - 4) % 12
# rounded, so that equal scores compare equal whatever the order of
# the terms
terms = [KERNEL[off] * values[s] for s, pos in stars.items()
for off in KERNEL if pos == (wealth + off) % 12]
return round(math.fsum(terms), 9)
def ranks(xs):
order = sorted(range(len(xs)), key=lambda i: xs[i])
r = [0.0] * len(xs)
i = 0
while i < len(order):
j = i
while j + 1 < len(order) and xs[order[j + 1]] == xs[order[i]]:
j += 1
for k in range(i, j + 1):
r[order[k]] = (i + j) / 2 + 1
i = j + 1
return r
def pearson(x, y):
n = len(x)
mx, my = math.fsum(x) / n, math.fsum(y) / n
sxy = math.fsum((a - mx) * (b - my) for a, b in zip(x, y))
sxx = math.fsum((a - mx) ** 2 for a in x)
syy = math.fsum((b - my) ** 2 for b in y)
return sxy / (sxx * syy) ** 0.5
if __name__ == "__main__":
cases = [(z, life) for z in range(12) for life in range(12)]
sa = [score(z, l, A) for z, l in cases]
sb = [score(z, l, B) for z, l in cases]
rho = pearson(ranks(sa), ranks(sb))
disagree = sum(1 for i, j in combinations(range(len(cases)), 2)
if (sa[i] - sa[j]) * (sb[i] - sb[j]) < 0)
pairs = len(cases) * (len(cases) - 1) // 2
top_a = set(sorted(range(len(cases)), key=lambda i: -sa[i])[:10])
top_b = set(sorted(range(len(cases)), key=lambda i: -sb[i])[:10])
print(" cases scored: {}; distinct scores A {}, B {}".format(
len(cases), len(set(sa)), len(set(sb))))
print(" Spearman rank correlation A vs B: {:.3f}".format(rho))
print(" pairs of cases ordered oppositely: {:.3f}".format(
disagree / pairs))
print(" top-10 cases shared: {} of 10".format(len(top_a & top_b)))
print("\nReading: two conventions that a practitioner could defend")
print("agree broadly but not in detail: they order a sizeable share of")
print("pairs of months oppositely and share only part of their 'best")
print("months'. A score is exactly as definite as its conventions.")Single source and citation
Fan, Y. (2026). Six-Dimensional Hypercube Walks, Hexagram Mutation Markov Chains and Modular Star-Palace Lattices (Version 1.0.0), Chapter 6: "Three Sides and Four Squares" Is a Convolution on the Ring of Twelve Palaces. 5D Library. https://doi.org/10.5281/zenodo.24090176
DOI: 10.5281/zenodo.24090176 · Read the monograph · 5DL-B-064 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026064,
author = {Fan, Yafu},
title = {Six-Dimensional Hypercube Walks, Hexagram Mutation Markov Chains and Modular Star-Palace Lattices},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
doi = {10.5281/zenodo.24090176},
url = {https://doi.org/10.5281/zenodo.24090176}
}Other chapter answers in this book
- Chapter 1 · The Sixty-Four Hexagrams Are a Six-Dimensional Cube
- Chapter 2 · Yarrow Stalks and Coins: the Exact Odds of the Two Methods
- Chapter 3 · The Markov Chain of Changing Hexagrams and Its Spectral Gap
- Chapter 4 · Which Text Is Read: the Rules for Moving Lines and a Good-or-Bad Function
- Chapter 5 · The Placement Rules of Zi Wei Dou Shu Are Maps Modulo 12
- Chapter 7 · The Number of the Great Expansion, the Before-Heaven Diagrams and the Origins of the *Zi Wei Dou Shu*
- Chapter 8 · A Four-Step Check and a Pre-Registered Matching Test