ePlaice / For the Best Software on the Net

Mainly Free and Open Source Software

Graphics Navigation

Bezier Curves | Bifurcation Diagram | Lorenz Attractor |

Valid XHTML 1.1

Latest news

Sep 22: New beta version 4.0.2091 of Google Earth available which includes layer data for Japan.

Aug 28: Canon have released the latest EOS 400D digital SLR. I wish I had waited a bit before buying the EOS 300D!!

Links:

Lorenz Attractor

Thumbnail example

In 1960 Lorenz tried to model the weather. He wrote simplified equations and solved them on a primitive computer. Sure enough, his output did behave a lot like real weather. His colleagues watched over his shoulder. They were fascinated. One day, Lorenz tried to continue a run he'd done the day before. He restarted it halfway through. He put in a number from the first run. The output started out just the way it had the day before. Then it began to diverge, crazily. The equations were the same. The starting point was the same. But the results diverged. Lorenz checked his computer. He checked his arithmetic. Nothing had changed. Same equations, but on subsequent days the results diverged. There was one difference, but how could it matter? Lorenz rounded off the fourth decimal place of the starting number on the second day. So he stopped to consider. All weather predictions do what his program just did. You can predict the weather for the day after tomorrow. Stretch that to a week, and your prediction always departs from reality.

The implication was staggering. We've always presumed that if you barely change a cause, you'll barely change the effect. Suddenly, Lorenz saw that the weather would change utterly if you started things out just a little differently.
No wonder real weather is so unpredictable! Weather obeys physical laws. But if you change one breath of air, those laws will spin out in a wholly different story.
Meteorologists began talking about something they called the Butterfly Effect. The idea was that if a butterfly chances to flap his wings in Beijing in March, then, by August, hurricane patterns in the Atlantic will be completely different.

Mathematical Basis

The Lorenz model is defined by three differential equations giving the time evolution of the variables X(t), Y(t), Z(t):
dX/dt = -c(X-Y)
dY/dt = aX-Y-XZ
dZ/dt = b(XY-Z)
Although the equations look quite simple, they are nonlinear depending on the products of the variables XZ and XY, and analytic solution is impossible in general. For a=26.5, b=1, c= 3, and rewriting X=x[1], Y=x[2] and Z=x[3] we get -3*(x[1]-x[2]), 26.5*x[1]-x[2]-x[1]*x[3], x[1]*x[2]-x[3]

Euler solves these differential equations using adaptive runge. First of all you have to define the function to be solved where x is a 1x3 vector as follows:-

function lorenz (t,x)
return [-3*(x[1]-x[2]), 26.5*x[1]-x[2]-x[1]*x[3], x[1]*x[2]-x[3]]]
endfunction

Then all that remains to be done is to call adaptiverunge differential equation solver :-
>adaptiverunge("lorenz",t,[0,1,0],0.001);

>load lorenz;

Plotting

This is done by calling function lorenza :-


function lorenza
t=0:0.02:40;
s=adaptiverunge("lorenz",t,[0,1,0],0.001);
v=view(4,2,0.5,0.5);
framedwire(s[1]/20,s[2]/20,s[3]/20-1);
title("The Lorenz attractor");
wait(180);
view(v);
return s
endfunction

Note that view provides the aspect ratio and distance
framedwire controls the plot

Rossler Attractor


This is coded in Euler in a very similar manner; involving solving the following non-linear equations :- dX/dt = -(Y + Z)
dY/dt = X + aY
dZ/dt = b + Z*(X-c)