!LORENTZ EQUATIONS

!dx/dt = S(y-x)

!dy/dt = R*x - y - xz

!dz/dt = xy -Bz

!USE S = 10, R = 28, B = 8/3, x0 = z0 = 0, y0 =1

!deltat = 0.001

SET MODE "graphics"

SET WINDOW -22,22,0,55

OPEN #1: SCREEN 0,1,0,.5

SET WINDOW 0,100,-20,20

OPEN #2: SCREEN 0,1,.5,1

SET WINDOW 0,100,0,50

WINDOW #0

LET S=10

LET R=28

LET B=8/3

LET x=0

LET z=0

LET y=1

LET DT = 0.005

SET COLOR "GREEN"

!PLOT 0,0;0,50

!PLOT -20,0;20,0

SET COLOR "BLUE"

DO WHILE t<=100

LET xdot = S*(y-x)

LET ydot = R*x - y - x*z

LET zdot = x*y - B*z

LET x = x + xdot*DT

LET y = y + ydot*DT

LET z = z + zdot*DT

LET t = t + DT

PLOT x,z;

WINDOW #1

!PLOT t,x;

WINDOW #2

!PLOT t,z;

WINDOW #0

LOOP

END