# Whether the weather be good or Dr Neil Challis, Dr Harry by asafwewe

VIEWS: 11 PAGES: 8

• pg 1
```									                             Whether the weather be good or...

Dr Neil Challis, Dr Harry Gretton
n.challis@shu.ac.uk h.gretton@shu.ac.uk
School of Science and Mathematics
Sheffield Hallam University
Sheffield S1 1WB
UK

Introduction

In 1963,Edward Lorenz of the Massachusetts Institute of Technology published a
paper with the title “Deterministic Nonperiodic Flow”. Lorenz had set out with the idea of
being a mathematician, but the Second World War intervened and he became a
meteorologist ,allegedly. However, he was still a mathematician at heart.(Mathematics is
like a permenant itch you always need to keep scratching it. In the abstract he summarises
his results:

“Finite systems of deterministic ordinary non-linear differential equations may be designed
to represent fqrced dissipative hydrodynamic flow. Solutions of these equations can be
identified with trajectories in phase space. For those systems with bounded solutions, it is
found that nonperiodic solutions are ordinarily stable with respect to small modifications, so
that slightly differing initial states can evolve into considerably different states. Systems with
bounded solutions are shown to possess bounded numerical solutions.
A simple system representing cellular convection is solved numerically. All of the
solutions are found to be unstable, and almost all of them are nonperiodic.
The feasibility of very long-range weather prediction is examined in the light of these
results.” [1]

The equations
The equations below were formulated by Edward Lorenz a few years ago as part of
an attempt to understand convection mechanisms in a gas (as for example in weather
systems). The results of solving these equations surprised him, but when they were
published they went relatively unnoticed until the full significance of chaos theory became
apparent. He coined the term “butterfly effect”.

The Lorenz equations ( non-linear and three-dimensional ) are:

dx
= − ax + ay
dt
dy
= bx − y − xz
dt
dz
= − cz + xy
dt

Let us investigate this set of equations with various technologies.

1
The software package FRACTINT

A good selection of pictures can be generated by the popular public domain
software Fractal Software [2]

FRACTINT Version 19.2

Parameters for fractal type Lorenz (Time Step 0.02)
a =5 b = 15 and c = 1
Lorenz two lobe attractor - orbit in three dimensions.
In 2 dimensions the x and y components are projected to form the image.
z(0) = y(0) = z(0) = 1;
x(n+1) = x(n) + (-a*x(n)*dt) + ( a*y(n)*dt)
y(n+1) = y(n) + ( b*x(n)*dt) - ( y(n)*dt) - (z(n)*x(n)*dt)
z(n+1) = z(n) + (-c*z(n)*dt) + (x(n)*y(n)*dt)
Parameters are dt, a, b, and c.

This software creates the following Lorentz Attractor: trajectories cycle ( plotting the phase
plane of x against y ) with the distinctive two lobes:

Figure 1
Looks pretty but is it valid and is is stable?

This situation can be readily set up on an Excel spreadsheet using the plain, straightforward,
unmodified Euler method:

xnew = xold + time step * xold
xnew = xold + time step * xold

2
xnew = xold + time step * xold

with the values as above - a = 5, b = 15, c = 1
with initial conditions of - x(0) = y(0) = z(0) = 1
For t varying from 0 to 20 in steps of 0.02 - the time step

Note this does not generate a phase plane but a 3D phase space, but in order to visualise
the solution we plot the projection of this phase space solution into 2D for example by
plotting y against x as in the FRACTINT version. This results in figure 2

Lorenz equations - xy projection

15

10

5
y

0                                   y
-10     -5           0       5      10          15
-5

-10

-15
x

Figure 2

It looks familiar!
The results from the spreadsheet are given below:

Lorenz equations
time         x           y           z
0          1           1           1     a=                  5
0.02         1         1.26          1     b=                 15
0.04       1.026      1.5148      1.0052   c=                1.00
0.06     1.07488     1.771677    1.01618   dt =              0.02
0.08     1.14456     2.036862    1.033943 x(0) =               1
0.1     1.23379     2.315825    1.05989 y(0) =                1
0.12    1.341993     2.613492    1.095837 z(0) =               1
0.14    1.469143     2.934408    1.144066
0.16     1.61567     3.282847    1.207406
0.18    1.782387     3.662875    1.289338
0.2    1.970436     4.078372    1.394125
0.22     2.18123     4.532995    1.526966
0.24    2.416406     5.03009     1.694176
0.26    2.677775     5.572534    1.903388

3
0.28       2.967251   6.162479     2.16376

So far so good.

The TI-86

When solving differential equations numerically a suitable affordable, portable,
personal computing equipment is the TI-85 which has in built software to solve these types
of equation and even better the TI-86 which not only has the TI-85 method Runge-Kutta of
solving differential equations but the user has the Euler method choice of solution.
The TI-86 was used to solve the Lorentz equations but here Euler method solution
was first found and then compared to the the Runge-Kutta method. In each case as above
the appropriate projection of the phase space y against x was plotted.

The TI-86 is first set in the DifEq mode i.e. the differential equation mode and the
Euler method selected. The following screens illustrate this process.

Then the differential equations together with the initial vales are inputted

Using the following screen window

we obtain the expected results:

4
The Euler Method shows the expected Lorenz Attractor,.

Now we use the Runge-Kutta method:
Setting the method in the first screen and using the same window settings as before (notice
the accuracy)

The numerical procedure just gives a pathetic little curve which tails off to nothing.

Here is a summary of the the TI-86 results :

Euler     t = 0 to 20                                Runge - Kutta t = 0 to 20

Interesting....

Conclusion
We have shown above how when Lorentz equations are solved the methods of solution
give peculiar results. When you put problems onto a computer you do nothing of the kind,

5
you represent some idealisationof the problem in the computer. this is one of the reasons
why a computer is not the answer to all our problems. It just is not aware of reality -- yet!
The chaotic results depends, in the case above, on the numerical scheme employed. It is
suprising that a more sophisticated method will produce and unexpected result - but what
does the theory of chaos give us if not an insight in the these types of phenomena.

Many avenues are left to explore with the these equations.
• Is there any regularity at all (what is a strange attractor?)?
• What effect would a small change in the initial conditions have on the solution as time
goes on (this is hinting at the butterfly effect!)?
• How come it looks like it is crossing itself (thought that wasn’t allowed?).
• What if you plot other projections of the phase trajectory (z against x etc.)?
• Can you find a way to plot the full 3D picture of the phase trajectory (z against y against
x)?

Try them with your own pet technology.

Its all quite thoght provoking and some lessons to note are never trust
• the weather
• the weather person
• a numerical solution
• more precise methods
• a differential equation
• a technology
• butterflies

“I don’t believe it” - Richard Wilson - One foot in the grave (TV programme)

[1]   “Does God Play Dice” Ian Stewart, Penguin 1990.
[2]   FRACTINT Version 19.2:
Distribution of Public (Software) Library, PO Box 35705, Houston, TX 77235-
5705, USA. Their phone number is 800-242-4775 In Europe, the latest
versions are available from another Fractint enthusiast, Jon Horner - Editor of
FRAC'Cetera, a disk-based fractal/chaos resource. Contact: Jon Horner,
FRAC'Cetera, Le Mont Ardaine, Rue des Ardaines, St. Peters, Guernsey GY7
9EU,CI, UK. Phone (44) 01481 63689. CIS 100112,1700

6
Blurb from FRACTINT
FRACTINT Version 19.2
Lorenz Attractors

The "Lorenz Attractor" is a "simple" set of three deterministic equations
developed by Edward Lorenz while studying the non- repeatability of weather
patterns. The weather forecaster's basic problem is that even very tiny
changes in initial patterns ("the beating of a butterfly's wings" - the
official term is "sensitive dependence on initial conditions") eventually
reduces the best weather forecast to rubble.

The lorenz attractor is the plot of the orbit of a dynamic system consisting
of three first order non-linear differential equations. The solution to the
differential equation is vector-valued function of one variable. If you think
of the variable as time, the solution traces an orbit. The orbit is made up
of two spirals at an angle to each other in three dimensions. We change the
orbit color as time goes on to add a little dazzle to the image. The
equations are:

dx/dt = -a*x + a*y
dy/dt = b*x - y -z*x
dz/dt = -c*z + x*y

We solve these differential equations approximately using a method known as
the first order taylor series. Calculus teachers everywhere will kill us for
saying this, but you treat the notation for the derivative dx/dt as though it
really is a fraction, with "dx" the small change in x that happens when the
time changes "dt". So multiply through the above equations by dt, and you
will have the change in the orbit for a small time step. We add these changes
to the old vector to get the new vector after one step. This gives us:

xnew = x + (-a*x*dt) + (a*y*dt)
ynew = y + (b*x*dt) - (y*dt) - (z*x*dt)
znew = z + (-c*z*dt) + (x*y*dt)

(default values: dt = .02, a = 5, b = 15, c = 1)

We connect the successive points with a line, project the resulting 3D orbit
onto the screen, and voila! The Lorenz Attractor!

We have added two versions of the Lorenz Attractor. "Type=lorenz" is the
Lorenz attractor as seen in everyday 2D. "Type=lorenz3d" is the same set of
equations with the added twist that the results are run through our
perspective 3D routines, so that you get to view it from different angles (you

7
can modify your perspective "on the fly" by using the <I> command.) If you
set the "stereo" option to "2", and have red/blue funny glasses on, you will
see the attractor orbit with depth perception.

Hint: the default perspective values (x = 60, y = 30, z = 0) aren't the best
ones to use for fun Lorenz Attractor viewing. Experiment a bit - start with
rotation values of 0/0/0 and then change to 20/0/0 and 40/0/0 to see the
attractor from different angles.- and while you're at it, use a non-zero
perspective point Try 100 and see what happens when you get *inside* the
Lorenz orbits. Here comes one - Duck! While you are at it, turn on the sound
with the "X". This way you'll at least hear it coming!

Different Lorenz attractors can be created using different parameters. Four
parameters are used. The first is the time-step (dt). The default value is
.02. A smaller value makes the plotting go slower; a larger value is faster
but rougher. A line is drawn to connect successive orbit values. The 2nd,
third, and fourth parameters are coefficients used in the differential
equation (a, b, and c). The default values are 5, 15, and 1. Try changing
these a little at a time to see the result.

Details
FRACTINT Version 19.2
Distribution of Public (Software) Library, PO Box 35705, Houston, TX 77235-
5705, USA. Their phone number is 800-242-4775 In Europe, the latest versions are
available from another Fractint enthusiast, Jon Horner - Editor of FRAC'Cetera, a disk-
based fractal/chaos resource. Contact: Jon Horner,
FRAC'Cetera, Le Mont Ardaine, Rue des Ardaines, St. Peters, Guernsey GY7 9EU,CI,
UK. Phone (44) 01481 63689. CIS 100112,1700

8

```
To top