The Fractal I Ching

This is experimental.  It generates hexagrams using a simple fractal algorithm, a slight modification of the Martin attractor by Barry Martin.

Enter strings of digits into the fields below:

x =

y =

a =

b =

c =

i =

Generate | back | forward | last

Fractal size: 

The raw numbers:  x, y, distance from the origin

Press Generate and the script will use the numbers in the form fields to generate the hexagram lines, which are displayed in the field to the right.  Below it is a graphic representation of the “fractal landscape” that the line numbers were based on, a small version of the actual fractal, and the hexagram reference(s).  Make any change to the parameters in the form to get different results.  The x value will be incremented if you simply press Generate over and over.  Check the box and the form will automatically use the system time and a random number as x and y parameters.

The algorithm is an iteration of the following:

x1 = y0 - sin((b * x0) - c)
y1 = a - x0

The equations work best when the initial x and y are small nonzero numbers, a is small, and b is greater than 3.  I added the c parameter to the equations to add to the variability; it can be any number.  The strings of digits in the x, y, and a fields are turned into digits after the decimal place (1380502597083 becomes 0.1380502597083, for example).  The i value is the number of iterations performed prior to reading the data; it should be a positive integer.  Large i values (over 1000000 or so on my system) may run slow, especially with Internet Explorer (to think I used to like that browser).  If you are using a fast browser, you can try the large fractal size, at the expense of speed.  (Besides using up more resources on the page, the large fractal is actually based on up to 10000 iterations, the small on up to 2000.)  The algorithm, as fractals are, is very sensitive to the slightest change in the equation parameters.  And the results are chaotic, not random.  Larger examples of fractals generated by the algorithm are shown at the upper right, and in the image gallery below.  Download Mandala Explorer if you want to play with it some more.  Why is this a fractal?

The points generated by the algorithm tend to loop around the origin quadrant by quadrant.  What the hexagram generator actually does is start with the x0 and y0 values entered into the form, then iterates the algorithm i times.  This lead-in determines the point in the sequence at which the data are read, and stabilizes the equations a bit.  It then records the distance from the origin (the square root of x2 + y2) of every 4th point, 14 times (which tends to be 14 consecutive points in the same quadrant).  The first and last points are used as a baseline.  The script then looks at the values of each distance with respect to the baseline and the range of distances, centering the range on zero to see if each point is above or below the center line.  What we are left with is a representation of the “jaggedness” of the series of values.  Beginning with the second point, each of the next six consecutive pairs of values is multiplied, and the sign of the result is used to determine the moving lines, negative = changing (in other words, crossing the center line; this tends to result in about 1/4 of the lines changing).  The first member of each pair is used to determine the line type, positive = yang and negative = yin.  Simple!

  = 7
  = 9
  = 8
  = 6

Landscape patterns

Generating hexagrams based on a fractal landscape opens up a whole new way of viewing the line patterns.  Some tend to be wave-like:

34  Great Strength
11  Peace
41  Decrease
42  Increase

Every now and then there is a simple straight line:

12  Obstruction

Many others are very chaotic, with multiple moving lines:

18  Corruption
13  Gathering

Like I said, this is experimental.  The results have about the correct distribution of lines (1.1 : 2.9 : 2.9 : 1.1), but they tend to cluster a little.  For example, the number of identical quadruplets should be about 3%, but tends to be more like 4%.  This is perhaps what is to be expected from a fractal landscape distribution, rather than a random one.  And certain hexagrams appear much more often than others; the broadly-patterned hexagrams 11, 12, 19, 20, 33, and 34 account for about 23% of the total, while 27, 28, 31, 32, 41, and 42 account for another 20%.  The finely-patterned hexagrams 29, 30, 37, 38, 39, 40, 63, and 64 account for only about 5%.

Redrawing the baseline as described above improved the results.  I have tried different parameters and sampling methods; the above seem to be as good as any.  Also note, the script uses JavaScript math; because of differences in things like the bit length of floating-point numbers, the results may differ between different browsers and operating systems.

Works for me in Firefox, Internet Explorer, and Safari.  I get strange behavior using Opera.  Updated 10/6/2013.

Image gallery