<

Binomial analysis of I Ching
yarrow stalks methods by Giga Gerard

for Persi Diaconis Magical Mathematics (2012),
  chapter 8, Magic in the Book of Changes.

Shimura: Taniyama was not a very careful person as a mathematician. He made a lot of mistakes. But he made mistakes in a good direction. So eventually he got right answers. I tried to imitate him, but I found out that it is very difficult to make good mistakes. [Horizon documentary]

To throw your coins for the I Ching with the exact same probability as the classic yarrow stalk method is easy to achieve. Follow my revised coin method:

Think of a 1 smaller even number if you actually count the odds and evens.
For example 0 for tails and 1 for heads to add up to the coin totals 0,1,2,3.
Or the traditional numbers 2 for tails or yin and 3 for heads or yang to count the lines as 6,7,8,9. Refer to the Book of the I Ching.
[classic source: Richard Wilhelm, I Ging, das Buch der Wandlungen, 1924]

The classic yarrow stalks are a means to obtain the six lines of a hexagram for the I Ching. But this procedure is tedious and discouraging. After some irregular practice it still takes me about half an hour to obtain the hexagram.
This fumbling with the sticks works as a distraction, a waste (sacrifice?) of your precious time, and is not the meditative experience that should help you focus on the question. For which you'd better close your eyes...
The counting you have to do is prone to mistakes, only human, you struggle to avoid them. All this doesn't prepare you well for communion with the poetic and enigmatic answers from the oracle Book. President Donald Trump would call the Chinese method a disaster!

But it also could be a historical mistake of cosmic proportions!! Bear with me:

For the main hexagram the chances of getting a young yang line and a young yin line are equal. Figure 7 and 8 both do 50%.
This is proper, because yang and yin should be in balance. There is as much yang as yin in the universe of the I Ching. Both primal principles (energy and inertia) must be preserved. Overall there should be as much of both, both before and after the changes, that you can read about in the Book of Changes.

But then, in the classic stalks oracle, after changes take effect, the sum of yin and the sum of yang lines, that should on average be equal, diverges from the mean. In the new lines of the secondary hexagram the weight of yin has grown close to 63% and the height of yang is a mere 37%. You can find that in the binomial analysis, end of table #0.
So my conclusion is: where the old lines change to their opposites, and the young lines remain, the skewed probability profile of the classic method goes counter the philosophy of yin and yang.
Or do you believe that the act of consulting an oracle will draw an excess of yin to your course? On the contrary, creativity and mental confusion may increase!

Could be dirt on the screen The best and easiest way, call it Trump yarrow stalking, is to do as little counting as possible. Just create a random half heap and leave the other halves untouched.
Take away 4 sticks a time as usual, until left with a remainder 0,1,2,3 to which you add the number 6 to get the 6,7,8,9 of yins and yangs. Let this simply form a line, and repeat it six times for a hexagram. Won't take long. Thank you mister Trump!
Of course all chances are even now: yin versus yang, old versus young. On average you will have 3 changing lines in a main hexagram, that is twice the average of the classic method. Dynamic, more unexpected changes!

This could well be the true ancient way of consulting the I Ching too. Because the first hexagram Heaven in the Book is all yang lines and the second Earth has six yin lines. So the number 1 always related to the unchanging yang 7 and number 2 to the unchanging yin figure 8, which involves adding 6.
Those additional six sticks the shaman or fortune teller could take from the left heap to start with. Hold them up firmly in his left hand, while counting off the right heap. The number 0 as such need not be thought of, no sticks is not a stick, but it adds to the surprise. For a stagnating old yin situation to change for the better...

As always all is well and in good order. Tao, the balance of opposites, rules, also in the antiquated methods of the I Ching in our fast era. But where, if not from our mental disposition, does the excess of young yin, projected into the future, originate? Can it be from the destruction of old yang cosmic information in the stalks method itself?
The problem on earth is waste, waste of divine inspiration. We walk our lives, unaware of the big black ship steaming up behind us. The sub-super-conscious knows! Bottom line is, we hold our tiny bits too tight, shielding them from any quantum noise. But the mistakes we make can be opportunities. Ponder this.

In the classic procedure, where exactly does the loss of information occur?
The remainder of each left pile of stalks holds 2 bits. But if you count off the right pile and add that remainder, you lose 1 bit. It is destroyed (broken even) without a trace. Repeat three times and you win and lose 6-3 = 3 bits of information.
Count those 3 bits up in such a way that 2 bits are kept. You seem to lose 1 bit again, but that is an illusion, for the lost bit creates the classic probability profile. Its random energy pulls the secondary hexagram down to yin, so to speak.

You might assume that after six repeats 2*6 = 12 bits will remain. The main hexagram takes up 6 bits, for it has 2^6 = 64 possibilities, and the secondary the other 6 bits, so it figures.
But this is only the case if the chances are the same 1/4 for each yin yang, as in Trump yarrow stalking. If you throw the standard three coins the chances are not equal, but in proportions of 1/8, so they require a range of 8, that is 3 bits per line, and 18 bits for a hexagram, with changes included.
The classic stalks probabilities require a number range of 16, that is 4 bits per line, and 24 bits for a hexagram which changes. Huh??

Western amateurs may use these page number methods to consult the I Ching. No need for coins or milfoil sticks, we can emulate them with the Book at hand!

American page flipping is good, Chinese manipulation of yarrow stalks is evil!
When you split a bunch of stalks, no matter their number, it is enough to count back to the remains of one pile, then the other remains is known, but their custom is to have people count off both piles in China!
Check this. The first scheme in our analysis adds remains of left and right piles at the 1st, 2nd and 3d turn for every variation of stalks (and choices to hold 0 or 1).

For example in case #3 below, in the - arrays, the positions themselves stand for the left pile remains, here 1 to 5 because mod 5 we take away 5 stalks at a time till 5 or less remain. First - array, in position 3, the subtotal must be 9.
Given that the second holds value reads 1, one stalk is subtracted as usual. It follows that the right pile has 9-3-1 = 5 remaining stalks.

A random number generator such as Math.random will return a semi-random floating number in the range of 0 to 1. Its seed comes from the computer clock. Following random floats should be independent.
We can reduce that float to some integer in JavaScript. Here a variable will hold a random integer from 6 to 9 (yin yang), each with 25% chance.

var rand; with(Math)
  rand = 6 + floor(random() * 4);

bigXi mouse cursor If we know the probabilities P of all the items in an array N beforehand, we can select an index i into that array at random.
You can show that function by clicking the JavaScript sample.
As a thrilling example, call it (mouseover on desktop, odd clicks on mobile) for the classic stalk method of the I Ching. Or click the handy icon to roll a single bigXi line. Six for a hexagram with yin & yang in perfect balance.

The random number generator makes probability profiles easy to work with. Actually, we don't need to pick a new rand for each line. According to Bjarne Stroustrup [in The C++ Programming Language 2013] we have to avoid some non-random bits in the lower registers. But the JavaScript float holds 54 number bits, and a changing hexagram requires only 12 bits, or 24 bits if the chances are classically rigged. Randomness is big, but its uses are so tiny!
Anyhow, we like to stick to our historical perspective. For the four hexagram lines: old yin O6, young yang O7, young yin O8, old yang O9, what is the absolutely best proportion to create such electronic hexagrams in the future?

There are 3 demands. The total probability is 100%, or as mathematicians know 1. Important is to balance yin and yang as equals. Both in the main hexagram, and after changing lines changed in the secondary hexagram.
We then have 3 independent relations for 4 unknowns. That leaves 1 parameter that we are free to set. From our analysis we learn that the proportion of young against old can be tweaked to reach perfection. Obviously a 50% chance to change lines is far too much. Sorry Mr Trump!

O6+O7+O8+O9 = 1
O6+O8 = O7+O9
O6+O7 = O8+O9
O7+O8 = Π*(O6+O9)

O6+O8 = 1/2 = O6+O7
O6 = O9 & O7 = O8
O7 = Π*O9 = Π/2/(Π+1)
O6 = 1/2/(Π+1)

Scroll the yin yang eggs down to arrive at their values!
A hexagram judgement should offer a sense of stability, like the forces that flow from Tao knows what they are doing.. One or two changing lines can be enough, or zero rather than four. So what is the right value for Π?
If we take π 3.141592… the probabilities
are..
    old yin O6 = old yang O9 0.120726…
and..
    yo yang O7 = yo yin O8 0.379273…

Perfect! On average we have O6*12 = 6/(π+1) 1.4487… changing lines in a hexagram. Slightly less than the 1.5 changes that occur in the classic procedure.

An interesting mathemagical exercise is, how to create this π based probability distribution by natural means. Should this involve circles?

A hint from Count George Buffon (1707-1788), a biologist. He showed that, if a needle is dropped from a height randomly on to a parallel ruled surface, the length of the needle equalling the distance between the lines, then the probability that the needle falls across a line is 2/π. This problem concerns angles and trigonometry and ratios, and therefore π.
[David Well's Dictionary of Curious and Interesting Numbers 1997].

We use this distribution in our BigXi method of the I Ching, and dedicate it to A.I. as a door to open the cosmic circle of Tao and improve upon its dualistic oracles.
In harmony with A.I. kingpin Xi defeats the peril of Nine made in China.