Skip to content

This is a simple 2D simulation where you can spawn particles of both positive and negative energies and they'll interact with each other due to their gravitational forces.

Notifications You must be signed in to change notification settings

4marnath/N-Body-Gravity-Simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 

Repository files navigation

N-Body Gravity Simulation

This is a simple 2D simulation where you can spawn particles of both positive and negative energies and they'll interact with each other due to their gravitational forces. The calculation follows Newtonian mechanics with the value of the universal gravitational constant, G, set to 0.01.

Since this is a 2D world, the force is inversely proportional to R instead of R^2. If two particles come too close, they won't collide but instead will pass through each other. Also keep in mind that spawning too many particles may cause some serious CPU load.

The directory contains an executable in the zip file and the python source folder. You need to have installed Python 3.9 or later along with Numpy and Pygame libraries to run the Python file.

Here's a demo of this project: https://www.youtube.com/watch?v=7g-jVOLUh2o

About

This is a simple 2D simulation where you can spawn particles of both positive and negative energies and they'll interact with each other due to their gravitational forces.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages