# Chaos

Chaos is one of the newest, and most exciting, branches of mathematics. The best, and simplest, definition of chaos I've seen comes from the Fractal FAQ (Links page). It defines chaos very well.
Chaos is apparently unpredictable behavior arising in a deterministic system because of great sensitivity to initial conditions. Chaos arises in a dynamical system if two arbitrarily close starting points diverge exponentially, so that their future behavior is eventually unpredictable.
What this means is that chaotic behavior, although appearing random, arises from a very rigid cause. It also is highly sensitive to any disturbances, because every change in the system will compound with time. Also, because of the extreme disorder, predicting the future path of the system is practically impossible.

The system this definition is referring to can be anything. A set of equations is a system, as well as more tangible things, such as weather patterns. All systems exhibit chaotic tendencies. Weather is a favorite example for many people. Forecasts are never totally accurate, and long-term forecasts, even for one week, can be totally wrong. This is due to minor disturbances in airflow, solar heating, etc. Each disturbance may be minor, but the change it create will increase geometrically with time. Soon, the weather will be far different than what was expected.
These same chaotic traits apply to math. Certain sets of equations, for example, can be repeated many times, creating images called fractals. Often, these two equations consist of only an X and Y variable and a few constants. Once the equations are repeated, or iterated, many times, and the results are plotted on a computer screen, incredibly complex images can be produced. These fractals exhibit all of the chaotic traits. They are very sensitive to small changes, they are unpredictable, and they appear chaotic, although they were created using very straightforward, non-chaotic equations.

Fractals can be produced in a number of ways. Most use a set of X and Y equations that are iterated. Some use X, Y, and Z equations. Other fractals may operate by a set of rules, and have no equations at all. The Game of Life, for example, contains no equations. It's chaotic behavior is modeled through a set of rules.
Because iteration is so common in fractals, a programmer making his/her own fractal must understand how to iterate equations. One simple way to do this is to setup four variables for the standard X-Y set. X0, X1, Y0, and Y1 are easy to remember. X0 is equal to the mathematic variable Xn-1. This simply represent the X value for the previous iteration. Likewise, X1 is the same as Xn. This represents the current X value - the one to be plotted on the screen.
To represent a simple iteration, the following snippet is algorithmic code for the Henon Attractor.

```/* BEGIN HENON ATTRACTOR ITERATION */
/* INITIALIZE VARIABLES */
X0 = 1
Y0 = 1
/* START UP A NEVER-ENDING LOOP */
WHILE (TRUE) DO
BEGIN
/* ITERATE THE X AND Y VARIABLES */
X1 = Y0 + 1 - (1.4 * X0 * X0)
Y1 = 0.3 * X0
/* PLOT THE NEW X-Y POINT */
PLOT(X,Y)
/* REASSIGN OLD X AND Y VARIABLES, IN PREPARATION FOR ANOTHER ITERATION */
X0 = X1
Y0 = Y1
END
```

That's how simple iteration is! This algorithmic form can be converted to any language : Basic, Pascal, C, Java, etc. The equations need only be changed to create a different fractal. You could easily substitute a Lorenz Attractor's formulas instead, and keep the rest of the code untouched. In fact, after I created the King's Dream Java applet, I merely altered the equations, and compiled a new, Henon Attractor applet!
One segment of this algorithm, however, must be altered fractal-by-fractal. The PLOT function must be written so that the program zooms the fractal to fit the screen, and plots the points correctly. For example, the Sierpinski Triangle outputs X and Y variables with a range between 0 and 1. So, when they're plotted, X and Y must be multiplied by the screen dimensions before being turned into a pixel on the monitor.
That's as simple as fractals are! Novice programmers should not be scared away by the intimidating look of fractals. Very simple methods produce very complex results. Almost anyone with a decent knowledge of a programming language, even if it's QBasic, can make these fractals. To download example programs, and learn how to create specific fractals, take a look at the fractal pages on this site. You'll be surprised how easy it is!