/lorenz-attractor

Animated 3D Lorenz attractor using matplotlib

Primary LanguagePythonMIT LicenseMIT

About this project

A script to plot, animate, or generate frames for the Lorenz attractor using matplotlib

Example output

🛠️ Setup/ Preparation

pipenv install --ignore-pipfile --skip-lock --python 3.9
pipenv shell

If faced by UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.

sudo apt-get install python3.9-tk

🚀 Usage examples:

Script options

python lorenz_attractor.py -h

  -h, --help     show this help message and exit
  -n , --steps   Frame/step count to simulate
  -r , --ro      ρ value of attractor
  -s , --sigma   σ value of attractor
  -b , --beta    β value of attractor
  -a, --animate  Animate flag
  -f, --frames   Save frames flag

Plot the lorenz attractor for the first 5000 frames

python lorenz_attractor.py -n 5000

Animate the lorenz attractor over time for the first 5000 frames

python lorenz_attractor.py -n 5000 -a

Save individual frames as images to animate using external tools

python lorenz_attractor.py -n 5000 -f