Skip to content

Interactive physics simulations (Chaos, Probability, Mechanics) built with Python, Pymunk, and Pygame.

Notifications You must be signed in to change notification settings

Alireza2317/physics-sim-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Physics Simulations with Python

Python Pymunk Pygame License

A collection of interactive 2D physics simulations built using Pymunk (physics engine) and Pygame (rendering). These scripts visualize fundamental concepts in mechanics, chaos theory, and statistics.

🧪 Simulations & Demos

1. Double Pendulum (Chaos Theory)

A simulation of a pendulum with another pendulum attached to its end. It demonstrates chaotic motion, where the system is highly sensitive to initial conditions.

Double Pendulum Demo

2. Galton Board (Probability)

A vertical board with interleaved rows of pegs. Balls drop from the top, bouncing randomly left or right. It demonstrates how the Binomial Distribution approximates the Normal Distribution (Bell Curve) as the number of balls increases.

Double Pendulum Demo

3. Simple Pendulum (Harmonic Motion)

A classic simulation of a simple pendulum subject to gravity and damping, visualizing the conversion between potential and kinetic energy.

Simple Pendulum Demo

🛠️ Requirements

  • Python 3
  • Pymunk: 2D rigid body physics library.
  • Pygame: Library for making visuals.

🚀 Getting Started

1. Installation

Clone the repository and install dependencies:

git clone [https://github.com/Alireza2317/Physics](https://github.com/Alireza2317/Physics)
cd Physics

# Install required libraries
pip install -r requirements.txt

2. Usage

Navigate to the specific folder and run the script:

# Example: Running the Double Pendulum
cd double_pendulum
python app.py

📂 Project Structure

.
├── double_pendulum/     # Chaos theory simulation
├── galton_board/        # Statistical distribution simulation
├── pendulum/            # Simple harmonic motion
└── requirements.txt

About

Interactive physics simulations (Chaos, Probability, Mechanics) built with Python, Pymunk, and Pygame.

Topics

Resources

Stars

Watchers

Forks

Languages