PDA

View Full Version : Lorenz Attractor



peter
02-04-2014, 21:15
Hi,


Uses "ui"
#INCLUDE "abc.inc"

OpenWindow 800,800
SetHandleDC hdc, hwnd

Dim h,x,y,z,f,xnew,ynew,znew As Single
Dim i As Long
h=0.0025 : x=0.06 : y=0.06 : z=0.06 : f=8/3

Canvas_Clear 0
DrawString 0,0,"LORENZ ATTRACTOR",%abc_white
Canvas_Redraw

For i=1 To 100000
xnew = x+10*h*(y-x)
ynew = y+h*(28*x-y-x*z)
znew = z+h*(x*y-z*f)
x=xnew
y=ynew
z=znew
Canvas_SetPixel(-x*12+400,y*12+400,%abc_white)
Next
Canvas_Redraw

While IsWindow(hwnd) And Key(27)=0
Sleep 10
Wend
Canvas_Window End hwnd