LORENZ_SIMULATION
Display a solution of the Lorenz Equations


LORENZ_SIMULATION, a MATLAB program which computes and displays solutions to the Lorenz equations for various initial conditions.

The Lorenz equations are an extremely simplified model of the weather, in which three differential equations describe the evolution of three variables. There are also three parameters whose values play the role of physical constants.

It was while studying these equations that Edward Lorenz discovered what he called "deterministic chaos". That is, at least for certain values of the parameters, solutions were extremely sensitive to the initial conditions.

The Lorenz equations are often written as

        x' = sigma * ( y - x )
        y' = x * ( rho - z ) - y
        z' = x * y - beta * z
      
where the parameters are positive. Typical values for the parameters are
        sigma = 10
        beta = 8 / 3 = 2.666...
        rho = 28
      
The value of rho has a strong influence on the behavior of solutions. The value rho=28 results in chaotic solutions, whereas rho=99.96 yields a regular pattern.

The LORENZ_SIMULATION program shows a 3D plot of the behavior of a solution to the Lorenz equations. The initial condition is varied randomly each time the user runs the program.

There is actually already a Lorenz demonstration program, called lorenzdemo(), which is part of the MATLAB demo set.

We modified the original program because we wanted to be able to vary the initial condition for the integration. This turned out to be far more difficult than we realized, since the lorenzdemo program is full of code that looks important, but actually is not used.

The key is that the lorenzdemo displays some buttons, and as soon as you push a button, it calls "lorenz", which is a built in MATLAB function. This function is probably the same as lorenzdemo. However, if you change lorenzdemo, you have not changed "lorenz"! In other words, you can make all the changes you want to lorenzdemo, but most of them will have no effect whatsoever, since lorenzdemo actually calls "lorenz".

It is inadvertently cryptic coding like this that fills the wards of our hospitals with bitter, disillusioned people who have lost all faith in their ability to understand programming.

This version, with the slightly altered name "lorenz_simulation", calls itself. Thus, if you change this code, you will see a change when you run it. For our purposes, we were able to change the initial condition Y0, and have that effect the calculation as we wanted.

Note, also, that the ordering of the variables is somewhat different than is to be seen in other contexts. For LORENZ_SIMULATION, the equations are

        x' = y * z - beta * x
        y' = sigma * ( z - y )
        z' = y * ( rho - x ) - z
      

Usage:

lorenz_simulation
runs the program, picking an initial condition at random.

Languages:

LORENZ_SIMULATION is available in a MATLAB version.

Related Data and Programs

BROWNIAN_MOTION_SIMULATION, a MATLAB program which simulates Brownian motion in an M-dimensional region.

COIN_SIMULATION, a MATLAB library which looks at ways of simulating or visualizing the results of many tosses of a fair or biased coin.

DICE_SIMULATION, a MATLAB program which simulates N tosses of M dice, making a histogram of the results.

DUEL_SIMULATION, a MATLAB program which simulates N repetitions of a duel between two players, each of whom has a known firing accuracy.

FAIR_DICE_SIMULATION, a MATLAB program which simulates N tosses of 2 dice, making a histogram of the results.

GAMBLERS_RUIN_SIMULATION, a MATLAB program which simulates the game of gambler's ruin.

HIGH_CARD_SIMULATION, a MATLAB program which simulates a situation in which you see the cards in a deck one by one, and must select the one you think is the highest and stop.

ISING_2D_SIMULATION, a MATLAB program which carries out a Monte Carlo simulation of an Ising model, a 2D array of positive and negative charges, each of which is likely to "flip" to be in agreement with neighbors.

LIGHTS_OUT, a MATLAB program which sets up the "Lights Out" game and allows a user to try to solve it.

LORENZ_EQUATIONS, a MATHEMATICA file which demonstrates how solutions to the Lorenz equations can be synchronized.

POISSON_SIMULATION, a MATLAB library which simulates a Poisson process in which events randomly occur with an average waiting time of Lambda.

RANDOM_WALK_1D_SIMULATION, a MATLAB program which simulates a random walk in a 1-dimensional region.

RANDOM_WALK_2D_AVOID_SIMULATION, a MATLAB program which simulates a self-avoiding random walk in a 2-dimensional region.

RANDOM_WALK_2D_SIMULATION, a MATLAB program which simulates a random walk in a 2-dimensional region.

RANDOM_WALK_3D_SIMULATION, a MATLAB program which simulates a random walk in a 3-dimensional region.

REACTOR_SIMULATION, a MATLAB program which a simple Monte Carlo simulation of the shielding effect of a slab of a certain thickness in front of a neutron source. This program was provided as an example with the book "Numerical Methods and Software."

ROULETTE_SIMULATION, a MATLAB program which simulates the spinning of a roulette wheel and the evaluation of certain common roulette bets.

SIR_SIMULATION, a MATLAB program which simulates the spread of a disease through a hospital room of M by N beds, using the SIR (Susceptible/Infected/Recovered) model.

THREE_BODY_SIMULATION, a MATLAB program which simulates the behavior of three planets, constrained to lie in a plane, and moving under the influence of gravity, by Walter Gander and Jiri Hrebicek.

TRAFFIC_SIMULATION, a MATLAB program which simulates the cars waiting to get through a traffic light.

TRUEL_SIMULATION, a MATLAB program which simulates N repetitions of a duel between three players, each of whom has a known firing accuracy.

Reference:

  1. Kathleen Alligood, Tim Sauer, James Yorke,
    Chaos: An Introduction to Dynamical Systems,
    Springer, 1997,
    ISBN: 0-387-94677-2,
    LC: QA614.8.A44.
  2. James Gleick,
    Chaos: The Making of a New Science,
    Viking, 1987,
    ISBN13: 978-0140092509,
    LC: Q172.5.C45.G54.
  3. Edward Lorenz,
    Deterministic Nonperiodic Flow,
    Journal of Atmospheric Science,
    Volume 20, 1963, pages 130-141.

Source Code:


Last revised on 16 February 2019