Skip to content

Here is a collection of all simulations that do not belong to any of the other themed repositories.

License

Notifications You must be signed in to change notification settings

hbarquanta/Physics-Simulations

Repository files navigation

Physics Simulations

Overview

Welcome to the Physics Simulations repository! This collection includes various physics simulations that do not belong to any of my other themed repositories. These simulations are created using Python and Jupyter Notebooks, providing an interactive and visual approach to understanding complex physical phenomena.

Table of Contents

Introduction

Physics simulations are powerful tools for visualizing and understanding physical processes and phenomena. This repository includes simulations such as the Double-Slit Experiment, Cellular Automata, the Double Pendulum, Fluid Dynamics, and Magnetism, which help illustrate core concepts in quantum mechanics, complex systems, fluid mechanics, and electromagnetism.

Prerequisites

Ensure you have the following software installed:

  • Python 3.x
  • Jupyter Notebook
  • NumPy
  • Matplotlib
  • Other dependencies as specified in the notebooks

Installation

Clone the repository and install the required libraries:

git clone https://github.com/hbarquanta/Physics-Simulations.git
cd Physics-Simulations

To install dependencies for a specific application, navigate to the application's directory and install the requirements:

cd Applications/Double_Pendulum
pip install -r requirements.txt

For the Fluid Dynamics application:

cd Applications/Fluid_Dynamics
pip install -r requirements.txt

For the Magnetism application:

cd Applications/Magnetism
pip install -r requirements.txt

Repository Structure

The repository is organized as follows:

Physics-Simulations/
├── Animations/
│   ├── automata_simulation.gif
│   ├── double_pendulum_simulation.gif
│   ├── double_slit_simulation.gif
│   ├── Magnetism_simulation.gif
│   ├── navier_stokes_simulation.gif
│   └── ...
├── Applications/
│   ├── Double_Pendulum/
│   │   ├── Double_Pendulum_App.py
│   │   └── requirements.txt
│   ├── Fluid_Dynamics/
│   │   ├── Fluid_Dynamics_App.py
│   │   ├── requirements.txt
│   │   └── car.png
│   ├── Magnetism/
│   │   ├── Magnetism_App.py
│   │   └── requirements.txt
│   └── ...
├── Cellular Automata.ipynb
├── Double_Slit_Experiment.ipynb
├── Double_Pendulum.ipynb
├── Fluid_Dynamics.ipynb
├── Magnetism.ipynb
└── README.md

Usage

To run the Jupyter notebooks, navigate to the repository directory and start Jupyter Notebook:

jupyter notebook

Open the notebook you are interested in from the Jupyter interface.

Contents

Double-Slit Experiment

  • Double_Slit_Experiment.ipynb: This notebook simulates the famous double-slit experiment, demonstrating the wave-particle duality of light and matter.
    • Animations: View the animations here.

Cellular Automata

  • Celular Automata.ipynb: This notebook explores cellular automata, including the Game of Life, illustrating how simple rules can lead to complex behaviors.
    • Animations: View the animations here.

Double Pendulum

  • Double_Pendulum.ipynb: This notebook describes the theoretical framework of the (chaotic) Double Pendulum, explores how a slight change of initial conditions leads to completely different solutions after a certain time span i.e. chaotic behavior, and also includes the basic code for the standalone application.
  • Double Pendulum Application: This application simulates the motion of a double pendulum.
    • How to Run:
      cd Applications/Double_Pendulum
      pip install -r requirements.txt
      streamlit run Double_Pendulum_App.py
    • Live Demo: Check out the live demo here.
    • Animations: View the animations here.

Fluid Dynamics

  • Fluid_Dynamics.ipynb: This notebook contains a basic implementation of fluid dynamics simulations using the Navier-Stokes equations.
  • Fluid Dynamics Application: This Streamlit application simulates fluid flow around various objects, such as circles, squares, ellipses, cars, and planes.
    • How to Run:
      cd Applications/Fluid_Dynamics
      pip install -r requirements.txt
      streamlit run Fluid_Dynamics_App.py
    • Live Demo: Check out the live demo here.
    • Animations: View the animations here.

Magnetism

  • Magnetism.ipynb: This notebook explores the magnetic field generated by bar magnets and simulates various configurations to visualize the resulting magnetic fields.
  • Magnetism Application: This Streamlit application simulates the magnetic field generated by two bar magnets, allowing users to control the dimensions, positions, and orientations of the magnets.
    • How to Run:
      cd Applications/Magnetism
      pip install -r requirements.txt
      streamlit run Magnetism_App.py
    • Live Demo: Check out the live demo here.
    • Animations: View the animations here.

Contributing

Contributions are welcome! If you would like to improve the simulations or add new ones, please fork the repository and submit a pull request.