Skip to content

Annvalentina13/Double-Pendulum-Simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Double Pendulum Simulation

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.

Project Overview

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

Physics Concepts Used

  • Classical Mechanics
  • Lagrangian Mechanics
  • Nonlinear Coupled Differential Equations
  • Chaos Theory
  • Numerical Integration (Runge–Kutta methods)

Mathematical Model

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.


Simulation Methodology

  1. Define physical parameters (mass, length, gravity)
  2. Derive equations of motion using Lagrangian mechanics
  3. Convert equations into a first-order ODE system
  4. Solve using numerical integration
  5. Generate plots and animations
  6. Visualize results using a web-based dashboard

📊 Outputs & Visualizations

The simulation generates the following outputs automatically:

Plots

  • 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

Animation

  • Double Pendulum Motion (GIF) – real-time visualization of chaotic motion

All outputs are stored in the outputs/ directory.

🖥️ Project Structure

double-pendulum-simulation/

├── 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

How to Run the Project

1 Install Dependencies

Ensure Python 3.9+ is installed.

pip install -r requirements.txt

2️ Run the Simulation (Default Parameters)

From the project root directory:

python -m backend.generate_outputs

3️ Run with Custom Parameters (Optional)

python -m backend.generate_outputs <theta1> <theta2> <time>

Example:

python -m backend.generate_outputs 1.57 1.58 25

4️ View the Visualization Dashboard

Open the following file in a web browser:

frontend/index.html

(No server is required.)

Technologies Used

  • Python
  • NumPy
  • SciPy
  • Matplotlib
  • HTML5
  • CSS3
  • JavaScript

Key Features

  • Dynamic simulation parameters
  • Chaos comparison with near-identical initial conditions
  • Phase-space analysis
  • Energy conservation validation
  • High-quality animation
  • Clean and responsive UI

Conclusion

  • 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.

Authors

  • Annie Valentina A

About

A physics-based double pendulum simulation demonstrating chaotic motion, nonlinear dynamics, and energy conservation using numerical methods. Includes chaos comparison, phase-space analysis, energy validation, and an interactive visualization dashboard built with Python and web technologies.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors