25 Years of Programming
An open source source for C, C++, OWL, BASIC, MDB, XLS, DOT, and more...
Home   Projects   Up   Sitemap   Search   Blog   Forum+Chat   About Us   Privacy   Terms of Use   Feedback   FAQ   Images   Services   Ads   Donate   Humor

Graphic display of iterated equation instability, deterministic chaos

If you have an equation that calculates a value of Y based on an input value of a variable X, you can take the value of Y you just calculated and use that as the input value (X) in another evaluation of the equation. Then take that Y and use it as X again, over and over. That is called iteration.

If you graph the successive values of Y, you discover that they form one of the following patterns:

  1. Become larger and larger, running away to infinity.
    Example: Y = X * X where starting X is greater than 1.
  2. Become smaller and smaller, running towards 1/infinity.
    Example: Y = X * X where starting X is between 0 and 1.
  3. Converge quickly to a single value, which repeats over and over.
    Example: Y = X.
  4. Settle to a cycle of two or more values, repeating the cycle forever.
    Example: Y = 1 / X.
  5. Generate unique values forever that never repeat. This is called deterministic chaos. Example below.

This program graphs the successive values of an equation that shows the interesting behaviors 3 through 5,  depending on the value of a variable R (see below). Each loop sets a new value of R and begins an iteration sequence, graphing the result. As R increases, the behavior goes from type 3 (single value) to type 4 (cyclical) with the number of points in the cycle rising from 1 to 2 to 4 to 8, etc. This is called period doubling. At higher R values, chaos appears, but even within the chaotic regions are areas where the behavior goes back to being cyclical. This phenomenon is best viewed using the BIFURCAT.BAS program and its descendants.

10 'PARABOLA.BAS 4-23-93 
11 'COPYRIGHT (C)1993 STEVEN WHITNEY. Initially published by http://25yearsofprogramming.com.
12 'Published under GNU GPL (General Public License) Version 2, with ABSOLUTELY NO WARRANTY.
13 'GRAPHIC DISPLAY OF EQUATION INSTABILITY.
14 'RELATED TO ROBERT MAY'S LOGISTIC MAP BIFURCATION DIAGRAM.
15 'THE LATER ITERATIONS CREATE A PARABOLA SHAPE.
16 'INSPIRED BY CHAOS, BY JAMES GLEICK, PAGE 176, AND DISCUSSED IN 
17 'DOES GOD PLAY DICE?, BY IAN STEWART, PAGE 157, AND IN
18 'CHAOS UNDER CONTROL, BY PEAK AND FRAME.
19 'SCREEN 12 :'ENABLE FOR IBM BASICA.
20 DEFDBL X-Y
30 CLS
40 WINDOW (0, 0)-(1, 1)
50 Y = .5
60 FOR R = 0 TO 4 STEP .01
62 	CLS
65 	Y = .5
70 	LOCATE 1, 1
80 	PRINT R, "Press any key to see the next iteration..."
90 	COLOUR = 0
100	COLOUR = (COLOUR + 1) MOD 7
110 		X = Y
120 		LINE -(X, X), 4
130 		Y = R * X * (1 - X)
140 		'PSET(X,Y),7
150 		LINE -(X, Y), 7
160 		A$ = INKEY$
170 		IF A$ > "" THEN 190
180 	GOTO 100
190 NEXT R

 

 

Valid HTML 4.01 Transitional Valid CSS
View content labeling at ICRA.
Copyright ©2008 Steven Whitney. Last modified 02/27/2008.