allrite

Strange Attractors – Computer Programs

The fern, Lorentz, and title fractals were drawn using the excellent freeware program Fractint. The latest version of this is available from here.

The Sierpinski Gasket transforms were created using The Desktop Fractal Design System from Iterated Systems Inc.

The phase portraits and Poincare sections were created in Euler for IBM OS/2, a freeware linear algebra package, using the scripts listed below. Excuse the rough and ready nature. The lack of comments is partially due to programming constraints.

pendphase.e
comment
Phase diagram of a non-linear pendulum.
endcomment
function pendphase
## pendphase draws a phase space diagram for the non-linear pendulum.
## The function requests parameters and initial conditions.
## It then solves the coupled ODE using a 4th order Runge-Kutta algorithm.

“** PHASE SPACE DIAGRAM OF A NON-LINEAR PENDULUM **”,
” “,
q = input(“Damping strength (q): “);
g = input(“Driver strength (g): “);
f = input(“Driver frequency (f): “);
” “,
“Initial Conditions (>-pi, pi)”,***
v = input(“theta: “);
w = input(“omega: “);
” “,
N = input(“Number of time steps (200): “);***
dt = input(“Step size: “);
k = [0,0;0,0;0,0;0,0];

hold off
plot (0,0)
setplot(-4,4,-4,4)
hold on

for t = 0 to N step dt;

v = v + (k[1,1] + 2 * k[2,1] + 2 * k[3,1] + k[4,1])/6;
w = w + (k[1,2]+ 2 * k[2,2] + 2 * k[3,2] + k[4,2])/6;

if v > pi;
v = -v – 2 * pi;
endif;

if v < -pi;
v = v + 2 * pi;
endif;

if w > pi;
w = w – 2 * pi;
endif;

if w < -pi;
w = w + 2 * pi;
endif;

x = v;
y = w;

if t > 20;
xplot(x,y);
endif;
end;
return 0;

endfunction;

## The time derivative of theta.
## Equal to omega.
return omega;
endfunction;

## The time derivative of omega.
return ((-1/q) * omega – sin(theta) + g * cos(f*t));
endfunction;

pendpoinc.e

comment
Phase diagram of a non-linear pendulum.
endcomment

function pendpoinc
## pendpoinc draws a Poincare section of the non-linear pendulum.
## The function requests parameters and initial conditions.
## It then solves the coupled ODE using a Runge-Kutta algorithm.

“** PHASE SPACE DIAGRAM OF A NON-LINEAR PENDULUM **”,
” “,
q = input(“Damping strength (q): “);
g = input(“Driver strength (g): “);
” “,
“Initial Conditions (>pi)”, v=”input(“theta:” “); w=”input(“omega:” “); ” “, N=”input(“Number” of time steps (>-pi,

200): “);
dt = 3*pi/100;
k = [0,0;0,0;0,0;0,0];
f = 2/3;

hold off
plot (0,0)
setplot(-4,4,-4,4)
hold on

for t = 0 to N step dt;
i = i + dt;

v = v + (k[1,1] + 2 * k[2,1] + 2 * k[3,1] + k[4,1])/6;
w = w + (k[1,2]+ 2 * k[2,2] + 2 * k[3,2] + k[4,2])/6;

if v > pi;
v = -v – 2 * pi;
endif;

if v < -pi;
v = v + 2 * pi;
endif;

if w > pi;
w = w – 2 * pi;
endif;

if w < -pi;
w = w + 2 * pi;
endif;

x = v;
y = w;

if t > 20 and i = 3 * pi;
xplot(x,y);
i = 0
endif;
end;
return 0;

endfunction;