you're reading...

Visualizing Chaos via Orbit Diagrams of Logistic Map and the Henon Map

Here is a simple C++ program that illustrates chaos through simple rule for updating floating point values. The simple rule for updating is known as Logistic Map.


using namespace std;
int main(){
  cout << " Example of Floating Point Chaos" << endl;
  float b = 3.90;
  float fish = 0.5;
  for ( int exp=0 ; exp < 100 ; exp++){
    cout << exp << ":  "<< fish <<endl;
    fish = fish * (1.0 - fish) * b;

In one class college freshman were introduced “interesting” ideas from the field of Computer Science. I tried to create some labs that would engage the students without being too technical or too dumbed-down. One successful lab had the students take a well-known chaotic function known as the logistic equation x(n+1) = r*x(n)*(1-x(n)) and asked them to try to form a visualization. Here are some of the results of the students.

Here are project results from CS0 students: Daniel Hagerstrand, Cody Mays, and Scott Resnick

Here is basic python code that generates the graphic for the orbit diagram of the logistic equation:

from Tkinter import *
import random
root = Tk()
canvas = Canvas(width=1000, height=750, bg='white')
canvas.pack(expand=YES, fill=BOTH)
text = canvas.create_text(50,10, text=&amp;quot;Chaos Test&amp;quot;)

def drawcircle(canv,x,y,radius,color):
    canvas.create_oval(x-radius,y-radius,x+radius, y+radius,width=0,fill=color)

# Feigenbaum bifurcation values.
# b1 = 3, b2 = 3.449490…,
# b3 = 3.544090…, b4 = 3.556441…, b5 = 3.568759…, and b6 = 3.569692

while r < 4:
    for pix in range(50):
        x = random.random()
        for i in range(100):
            x = r*x*(1-x)

Here is basic python code that generates the graphic for the orbit diagram of the Henon Map:


from Tkinter import *
import random
root = Tk()

def drawcircle(canv1,x,y,radius,color):
    canv1.create_oval(x-radius,y-radius,x+radius, y+radius,width=0,fill=color)

canvas = Canvas(width=1400, height=800, bg='white')
canvas.pack(expand=YES, fill=BOTH)
text = canvas.create_text(100,10, text="    Orbit Diagram of the Henon Map"

def HenonMap(a,b,x,y):
	return y + 1.0 - a *x*x, b * x

# Map dependent parameters
a = 1.4
b = 0.3
iterates = 100000
xtemp = 0.1
ytemp = 0.2

for pix in xrange(0,iterates):
    xtemp, ytemp = HenonMap(a,b,xtemp,ytemp)


Henon map imagecda70-screen-capture



No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: