<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2715.400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2>I wrote a C program that simulates the Lorenz 
attractor</FONT></DIV>
<DIV><FONT face=Arial size=2>and plots the results. The graphic mode should 
be set.</FONT></DIV>
<DIV><FONT face=Arial size=2>Here is the basic subroutine. Maybe somebody 
will find</FONT></DIV>
<DIV><FONT face=Arial size=2>it useful.</FONT></DIV>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>Regards</FONT></DIV>
<DIV><FONT face=Arial size=2>Jarek</FONT></DIV></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>void Lorenz(void)<BR>{<BR>/* simulation variables/parameters: 
*/<BR>  float x = 0.1;<BR>  float y = 0.0;<BR>  
float z = 0.0;<BR>  float s = 10.00;<BR>  float r = 
28.00;<BR>  float b =  2.67;<BR>  float dt = 
100E-6;<BR>/* graphics' variables/parameters: */<BR>  float xxscale = 
0.02*(float)(getmaxx()+1); /* for plot scaling */<BR>  
float yyscale = 0.01*(float)(getmaxy()+1); /* for plot scaling 
*/<BR>  WORD xx0 = (getmaxx()+1)/2;     /* 
plot center x */<BR>  WORD yy0 = 
(getmaxy()+1)/2;     /* plot center y 
*/<BR>  WORD color = 15;</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>/* border, x and y axes: */<BR>  
setcolor(DARKGRAY);<BR>  
rectangle(0,0,getmaxx(),getmaxy());<BR>  line(0,yy0,getmaxx(),yy0); 
line(xx0,0,xx0,getmaxx());<BR>/* loop: */<BR>  while ( kbhit() ) 
getch();<BR>  do<BR>  {<BR>  
  float dx,dy,dz;<BR>    WORD    
xx,yy;</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>    /* put a pixel: */<BR>    xx 
= xx0+(int)(xxscale*x); yy = yy0-(int)(yyscale*z);<BR>  
  putpixel(xx,yy,color);<BR>    /* new x,y,z values: 
*/<BR>    dx = dt * (s*(y-x));<BR>    dy = dt * 
(r*x - y - x*z);<BR>    dz = dt * (x*y - 
b*z);<BR>    x += dx; y += dy; z += dz;<BR>    /* 
next color: */<BR>    color++; if ( color > 15 ) color = 
0;<BR>  }<BR>  while ( !kbhit() );<BR>}</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV></BODY></HTML>