Inspiration

Space is cool. Simulations are cool. Gravity is cool. Space Gravity Simulations are cool.

What it does

We use an nbody algorithm to simulate the orbits of planets in the solar system. This means that we are not only calculating the effect of the Sun on Mercury, but the effect of Jupiter on Mercury too. However, our GUI only shows the first 4 planets and earths moon on the screen. We can even add our own custom planets and asteroids to the calculations, but currently user generated objects are not supported.

Our simulation is also surprisingly accurate, e.g the earths orbit takes 365.256 days. The orbits are also very close to their real orbits.

How we built it

We used pygame to create the GUI, and we used numpy and numba to implement and speed up the N Body algorithm.

Challenges we ran into

We needed to run atleast 9000 iterations of an O(n^2) algorithms every second. So optimizing was really hard.

Accomplishments that we're proud of

We run 900 iterations of an O(n^2) algorithm every second. Also we used numpy and numba to make our code 5-10 faster than the original native python implementation. We are also proud of how the GUI looks.

What we learned

We learned about a lot of different python libraries (many of which we didn't end up using). We also learned about a very cool physics concept. Finally we got first hand experience with building an interactive GUI, and calculating and optimizing linear algebra operations. Also the GUI looks pretty good.

What's next for Solar System, n-body thing

We hope to optimize our algorithm even more. Once the algorithm is fast enough, we will be able to handle user generated asteroids (inputted through the GUI). Then we could do some really fun experiments (what if Venus was the size of Jupiter. Or what if there was a planet between Mars and Jupiter, etc).

Built With

Share this project:

Updates