A physics-based simulation of a double pendulum system demonstrating chaotic motion, nonlinear dynamics, and energy conservation using numerical methods.
The project combines scientific modeling with an interactive visualization dashboard.
The double pendulum is a classical mechanical system consisting of two pendulums attached end-to-end.
Despite its simple structure, the system exhibits chaotic behavior, meaning that very small changes in initial conditions can lead to drastically different trajectories.
This project simulates the system numerically and visualizes:
- Chaotic sensitivity to initial conditions
- Phase-space behavior
- Energy conservation
- Real-time pendulum motion
- Classical Mechanics
- Lagrangian Mechanics
- Nonlinear Coupled Differential Equations
- Chaos Theory
- Numerical Integration (Runge–Kutta methods)
The equations of motion are derived using Lagrangian mechanics, where:
[ \mathcal{L} = T - V ]
The system results in two coupled, nonlinear second-order differential equations for the angular positions of the pendulums.
Since these equations cannot be solved analytically, they are solved numerically using adaptive Runge–Kutta methods.
- Define physical parameters (mass, length, gravity)
- Derive equations of motion using Lagrangian mechanics
- Convert equations into a first-order ODE system
- Solve using numerical integration
- Generate plots and animations
- Visualize results using a web-based dashboard
The simulation generates the following outputs automatically:
- Angles vs Time – temporal evolution of motion
- Chaos Comparison – sensitivity to initial conditions
- Phase Space Plot – nonlinear dynamics (θ vs ω)
- Energy Conservation Plot – numerical accuracy validation
- Double Pendulum Motion (GIF) – real-time visualization of chaotic motion
All outputs are stored in the outputs/ directory.
├── backend/
│ ├── __init__.py
│ ├── model.py # Physics equations
│ ├── solver.py # Numerical solver
│ └── generate_outputs.py # Plot & animation generation
│
├── frontend/
│ ├── index.html # UI dashboard
│ ├── style.css # Styling
│ └── script.js # Interactivity
│
├── outputs/
│ ├── plots/
│ └── animations/
│
├── README.md
└── requirements.txt
Ensure Python 3.9+ is installed.
pip install -r requirements.txtFrom the project root directory:
python -m backend.generate_outputspython -m backend.generate_outputs <theta1> <theta2> <time>Example:
python -m backend.generate_outputs 1.57 1.58 25Open the following file in a web browser:
frontend/index.html(No server is required.)
- Python
- NumPy
- SciPy
- Matplotlib
- HTML5
- CSS3
- JavaScript
- Dynamic simulation parameters
- Chaos comparison with near-identical initial conditions
- Phase-space analysis
- Energy conservation validation
- High-quality animation
- Clean and responsive UI
- This project demonstrates how simple physical systems can exhibit complex and chaotic behavior. By combining solid theoretical modeling, numerical methods, and clear visualization, the simulation provides both scientific insight and an engaging user experience.
- Annie Valentina A