Visualizing the beauty in physics and mathematics
In roughly four and a half billion years, our Milky Way galaxy will collide with our nearest neighbour, the Andromeda galaxy.
The demo below simulates this future collision. It is based on a very simple model:
👉 Both galaxy’s contain only a very limited amount of stars compared
to the real amounts in both galaxy’s (1400 for the Milky way and 2800 for the Andromeda)
👉 No super-massive black holes at the center of either galaxy
👉 Masses and positions of stars are randomly picked from a normal distribution
(with a Box-Müller transform).
👉 VPython's simple_sphere
objects are used to optimize performance.
Even more spectacular and realistic pictures and animations can be found on nasa.gov.

On this site, you can also find a live demo of a way more advanced 2D spiral galaxy simulator that is based on the density wave theory (on GitHub → Galaxy renderer). It is written by Ingo Berg in Typescript. Click on the image below to activate this demo!
Share on: