/**************************************************************************** * R O E S S L E R A T T R A C T O R * * ------------------------------------------------------------------------- * * TUTORIAL: * * * * Until recently, the only known attractors were the fixed point, the * * limit cycle and the torus. In 1963, Edwards Lorenz, meteorologist at the * * M.I.T.,discovered a practical example of a simple dynamic system presen- * * ting a complex behaviour. To adapt them to computers available at that * * time, he began with simplifying the equations of metéorology to obtain * * finally a model composed of three differential equations with three * * unknown variables x, y, z and three parameters a, b, c: * * * * dx / dt = - a x + a y * * dy / dt = b x - y - x z * * dz / dt = -c z + x y * * * * During very long simulations on a computer, Lorentz decided, to check a * * result, to restart the same calculation halfway in order to spare time. * * For that, he reinjected into the computer the intermediate date obtaine * * earlier. He was very surprised to see that the new results were comple- * * tely different from the first ones. After he suspected some computer * * failure, Lorenz understood at last that the big difference between both * * solutions came from very small differences in data. These small pertur- * * bations exponentially amplified themselves, being doubled every four * * days in simulated time, so after two months the results became entirely * * different ! * * * * Lorenz then realized that it would be very difficult to make meteorolo- * * gical foresights in the long term, the slightest change in initial con- * * ditions leading to a radically different evolution of atmosphere. * * * * This is still the case today with atmospheric models much more sophis- * * ticated. * * * * None of the three attractors known at the time could predict the beha- * * viour of such a dynamic system. Lorenz had just discovered a strange or * * "chaotic" attractor to which his name was given, see program lorentz.pas * * * * The Roessler attractor is similar to the Lorenz attractor, by taking the * * following differential system of equations: * * * * dx / dt = -( y + z ) * * dy / dt = x + ( y / 5 ) * * dz / dt = 1/5 + z ( x - 5,7 ) * * * * ------------------------------------------------------------------------- * * REFERENCE: * * "Graphisme dans le plan et dans l'espace avec Turbo Pascal 4.0 * * By R. Dony - MASSON, Paris 1990" [BIBLI 12]. * * * * C++ version in API style by J-P Moreau * * (to be used with roessler.mak and gr2d.cpp) * * (www.jpmoreau.fr) * ****************************************************************************/ #include #include #include #include HDC hdc; RECT rect; //Functions used here of module Gr2D.cpp void Fenetre(double,double,double,double); void Cloture(int,int,int,int); void Bordure(); void MoveXY(double,double); void LineXY(double,double); //"home made" graphic commands for hdc environment used by above functions void DrawPixel(int ix,int iy) { //sorry, no other available command found Rectangle(hdc,rect.left+ix,rect.top+iy, rect.left+ix+2,rect.top+iy+1); } void Swap(int *i1,int *i2) { int it; it=*i1; *i1=*i2; *i2=it; } void DrawLine(int ix1,int iy1,int ix2,int iy2) { int i,il,ix,iy; float dx,dy; if (ix2