global a as float
global b as float
global c as float
c=2.666
a=10
b=28
type vec3
x as float
y as float
z as float
endtype
numUnits=1000
dim positions(numUnits) as vec3
for n=1 to numUnits
positions(n).x=rnd(10000)/100.0-50
positions(n).y=rnd(10000)/100.0-50
positions(n).z=rnd(10000)/100.0-50
make object sphere n,1
repositionObject(n)
recolorObject(n)
next n
sync on
sync rate 60
set ambient light 40
do
for n=1 to numUnits
updatePosition(n,.001)
updatePosition(n,.001)
updatePosition(n,.001)
recolorObject(n)
repositionObject(n)
next n
if spacekey()
position camera object position x(1),object position y(1), object position z(1)
endif
controlCamera()
sync
loop
end
function ZeroToOneSine(arg as float)
num#=(sin(arg)+1)/2
endfunction num#
function updatePosition(n as integer,timestep as float)
tmpx#=positions(n).x+getXRate(positions(n).x,positions(n).y,positions(n).z)*timestep
tmpy#=positions(n).y+getYRate(positions(n).x,positions(n).y,positions(n).z)*timestep
tmpz#=positions(n).z+getZRate(positions(n).x,positions(n).y,positions(n).z)*timestep
positions(n).x=tmpx#
positions(n).y=tmpy#
positions(n).z=tmpz#
endfunction
function recolorObject(n as integer)
color object n, rgb(ZeroToOneSine(positions(n).x*6)*255,ZeroToOneSine(positions(n).y*6)*255,ZeroToOneSine(positions(n).z*6)*255)
endfunction
function repositionObject(n as integer)
position object n, positions(n).x,positions(n).y,positions(n).z
endfunction
function controlCamera()
if mouseclick()=1
move camera 1
endif
if mouseclick()=2
move camera -1
endif
yrotate camera 0,camera angle y(0)+mousemovex()/10.0
xrotate camera 0,camera angle x(0)+mousemovey()/10.0
endfunction
function getXRate(x as float, y as float, z as float)
dxdt as float
dxdt=a*(y-x) //for rossler attractor: dxdt=-y-z
endfunction dxdt
function getYRate(x as float, y as float, z as float)
dydt as float
dydt=x*(b-z)-y //for rossler attractor: dydt=x+a*y
endfunction dydt
function getZRate(x as float, y as float, z as float)
dzdt as float
dzdt=x*y-c*z //for rossler attractor: dzdt=b+z*(x-c)
endfunction dzdt

simple input -> complicated results! A lorenz attractor exhibits chaos. This program can also simulate other dynamic systems.