Skip to content

3D animation of the Lorenz Attractor trajectory, implemented in Python using the 4th order Runge-Kutta method. [Personal project]

License

Notifications You must be signed in to change notification settings

Hevenicio/3D-Lorenz-Attractor-simulation-with-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

3D-Lorenz-Attractor-simulation-with-python

3D animation of the Lorenz Attractor trajectory, implemented in Python using the 4th order Runge-Kutta method.

Theory

The Lorenz attractor is a set of chaotic solutions to a system of ordinary differential equations called the Lorenz system. First studied by Edward Lorenz with the help of Ellen Fetter, who developed a simplified mathematical model for atmospheric convection. The model is a system of three ODEs:

$$ \frac{dx}{dt} = \sigma (y - x) $$

$$ \frac{dy}{dt} = x(\rho - z) - y $$

$$ \frac{dz}{dt} = xy - \beta z $$

The state variables are x, y and z. The rate at which states are changing is denoted by dx/dt, dy/dt and dz/dt respectively. The constants σ, ρ and β are the physical parameters.

A snippet of the code:

def EDOs(t, r):
    """Definition of the Lorenz ODE system"""
    x, y, z = r
    return np.array([sigma*(y - x),   # dx/dt
                     x*(rho - z) - y, # dy/dt
                     x*y - beta*z])   # dz/dt

def RK4(t, r, f, dt):
    """Definition of the 4th order Runge-Kutta method"""
    k1 = dt*f(t, r)
    k2 = dt*f(t + dt/2, r + k1/2)
    k3 = dt*f(t + dt/2, r + k2/2)
    k4 = dt*f(t + dt, r + k3)
    return r + (k1 + 2*k2 + 2*k3 + k4)/6

About

3D animation of the Lorenz Attractor trajectory, implemented in Python using the 4th order Runge-Kutta method. [Personal project]

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages