The Lorenz Attractors are governed by the following System of Ordinary Differential Equations:
For more information Click here.
Demonstrate the chaotic nature of the Lorenz Attractors with slight variation in the initial conditions.
-
numpy
-
scipy
using theintegrate
module -
pygame
3 instances of the lorenz
class were created with slight variation in their initial conditions. these conditions were random using numpy's uniform random number generator:
[np.random.uniform(0.99, 1.01),np.random.uniform(0.99, 1.01),np.random.uniform(0.99, 1.01)]
The initial condition was centered around [1, 1, 1]
. This is to stop the points in the solution from displaying off the pygame display.
NOTE: Initial conditions will be printed in the terminal.
The System of Ordinary Differential Equation were solved by using, solve_ivp
function, Then the plot.game
method is called which generates the interactive pygame display with the 3 solutions: white red and/or blue, appearing point by point at 30 fps.
Run the python file main.py
.
- Press
s
to start then select one of the following options:
-
press
a
to generate all 3 solution on the display at the same time. -
press
w
to generate the white solution. -
press
g
to generate the green solution. -
press
b
to generate the green solution.
-
Press
q
or close the window to quit. -
Press
r
to reset the display. -
follow on from step 1 to generate a new plot.
It is clear, by observing all 3 solutions after a sufficent amount of time, there nature is hugely different. Then it can be said with a slight change in the Lorenz Attractors initial conditions, these models will have different solutions after a long period of time.