The Original I Ching
esenfr
← all experiments
↝ · simple walk on Q6

Random walk and coverage

How long a walker takes to see all 64

Launch the walker and see how many steps it takes to visit the 64 hexagrams.

A walker starts at Kun and, at each step, mutates one line at random. It is the simple random walk on the hypercube. Two classic questions: how long does it take to return to the origin, and how long to see the 64 states? The first has an exact answer; the second is estimated by simulation.

1/64
seen in this walk
0
steps taken
64
expected return (exact)
≈ 360
mean cover time (simulated)
at ䷁ 2. Kūn
1/64

the pale node is the walker; the green ones are already seen; the ring marks the origin (Kun)

Simulation (2,000 cover times)
–
mean cover time (steps)
–
one sample cover time
–
one sample return (theory 64)

The expected return time to the origin is exactly 64: since the walk is symmetric, its stationary distribution is uniform (1/64 per state) and the mean return is its inverse. Covering the 64 takes far longer, some 360 steps on average: visiting the last handful of new states is what costs the most. The simulation with a fixed seed stays inside that band, verified by the suite.

The walker's bell

The walker's number of yang is not uniform: its stationary distribution is exactly the binomial C(6,k)/64, because there are C(6,k) hexagrams with k yang lines and all are equally likely. As visits accumulate, the bell emerges from the throws: the law of large numbers live.

0123456yang lines

bars = observed frequency · dotted outline = binomial C(6,k)/64 (the exact stationary distribution)

–
simulated steps
–
max deviation vs binomial
20/64
peak: C(6,3)/64

The speed of this convergence is the spectral gap of the spectrum of Q6: the second eigenvalue of the walk (4/6) sets how long it takes to mix. And the bell is the widest of the distributions over the 64: its entropy by number of yang is maximal at the centre. The suite closes it: with 200,000 steps and a fixed seed, the deviation stays below 0.003.