An interactive visualization of the Lorenz attractor that allows real-time parameter adjustment to explore chaos theory and dynamic systems. Watch how the famous butterfly-shaped attractor changes as you modify its parameters!
- Interactive Features
- Installation Guide
- Running the Application
- Troubleshooting
- Mathematical Background
- Theory and Concepts
Adjust these parameters in real-time using smooth sliders:
- σ (Sigma): 0-50 (default: 10.0)
- Controls fluid viscosity
- Higher values = more "sticky" fluid
- ρ (Rho): 0-100 (default: 28.0)
- Controls temperature difference
- Values > 24.74 create chaotic behavior
- β (Beta): 0-20 (default: 8/3)
- Controls system geometry
- Affects the "wings" of the butterfly pattern
- Multiple trajectories with different initial conditions
- Color-coded paths for better visualization
- Dark theme for enhanced contrast
- Real-time updates as parameters change
- Interactive 3D navigation (rotate, zoom, pan)
- Start with default parameters to see the classic butterfly pattern
- Make small adjustments to ρ to see how the system becomes chaotic
- Watch multiple trajectories diverge despite similar starting points
- Use the navigation toolbar to rotate and explore the 3D structure
- Python 3.10 or later (with Tkinter, included by default)
- Required Python packages:
- numpy
- matplotlib
-
Install Python 3.10 from Python's official website
- During installation, check:
- "Add Python to PATH"
- "tcl/tk and IDLE" (should be checked by default)
- During installation, check:
-
Install required packages:
python -m pip install numpy matplotlib
- Python 3.10 or later (with Tkinter from Homebrew)
- Required packages: numpy, matplotlib
- Install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Install Python:
brew install [email protected]
- Install packages:
python3 -m pip install numpy matplotlib
sudo apt update
sudo apt install python3.10 python3.10-tk python3-pip
python3 -m pip install numpy matplotlib
sudo dnf install python3.10 python3.10-tkinter python3-pip
python3 -m pip install numpy matplotlib
- Navigate to the project directory
- Run the visualization:
Windows:
python lorenz_attractor.py
macOS/Linux:
python3 lorenz_attractor.py
-
"No module named '_tkinter'"
- Windows: Reinstall Python with "tcl/tk and IDLE" checked
- macOS:
brew reinstall [email protected]
- Ubuntu/Debian:
sudo apt install python3-tk
- Fedora/RHEL:
sudo dnf install python3-tkinter
-
"No module named 'numpy'/'matplotlib'"
# Windows python -m pip install numpy matplotlib # macOS/Linux python3 -m pip install numpy matplotlib
-
Window appears but is unresponsive
- Update matplotlib:
python -m pip install --upgrade matplotlib
- Update matplotlib:
-
Display issues on Linux
- For WSL: Configure X11 forwarding
- Try:
sudo apt install libx11-dev
The Lorenz system models fluid convection with three key parameters:
-
σ (Sigma): The Prandtl number
- Describes fluid viscosity vs. heat conductivity
- Default: 10.0 (like air at room temperature)
-
ρ (Rho): The Rayleigh number
- Represents temperature difference
- Critical value: 24.74 (onset of chaos)
- Default: 28.0 (chaotic regime)
-
β (Beta): The geometric factor
- Related to system physical dimensions
- Default: 8/3 (classic butterfly shape)
The Lorenz system is defined by three coupled differential equations:
dx/dt = σ(y - x)
dy/dt = x(ρ - z) - y
dz/dt = xy - βz
Where:
- x: Rate of fluid flow
- y: Temperature difference
- z: Vertical temperature variation
The 3D plot represents:
- X-axis: Rate of fluid flow
- Y-axis: Temperature differences
- Z-axis: Vertical temperature variation
- Trajectories: System evolution over time
- "Wings": Stable regions of the attractor
Edward Lorenz discovered this system in 1963 while studying weather patterns. He found that tiny differences in initial conditions led to vastly different outcomes, introducing the concept of the "butterfly effect."
The Lorenz system demonstrates key chaos principles:
- Sensitivity to initial conditions
- Bounded but non-repeating behavior
- Deterministic unpredictability
The visualization shows these through:
- Multiple trajectories with slightly different starts
- The bounded butterfly-shaped attractor
- Unpredictable switching between wings