“If you wish to make apple pie from scratch, you must first create the universe” - Carl Sagan

Inspired by one of Carl Sagan’s most famous quotes, applepy is an n-body simulation program based in Python that aims to simulate many of the processes that occurred in the early stages of the universe.

Shortly after the Big Bang, there was an abundance of material scattered across the universe. As the universe expanded, this material began to interact with with itself through forces such as gravity, eventually forming the stars and galaxies that we see today. The behaviour of this material does not have an exact solution (unlike calculating the trajectory of a ball thrown on earth, for example), and so scientists run n-body simulation experiments, such as the Millennium Run, in order to best study how the early universe evolved.

Big Bang

This project is currently in the early development stages, and there are plans to do a complete rebuild of this project, from the ground up. I intend to eventually make this into a fully featured physics engine for running physics simulations, built into a full-stack web application.

Below is what one of the very first versions looked like (those little white dots represent point masses that move based on how the force of gravity affects the masses):


So far, this program is able to inefficiently do basic n-body simulations, using the Euler method of solving for the equations of motion. Check out the GitHub repository for this project for the source code, and some additional information.