This project is a simple 2D N-body simulator written in JavaScript that explores the cosmological implications of negative mass. Inspired by the theories of Andrei Sakharov and Jean-Pierre Petit (Janus Model), it demonstrates how gravitational repulsion from negative mass can lead to the formation of “soap bubble” structures, filaments, and voids.

The simulation operates on the Janus interaction laws, which differ from standard Newtonian gravity by introducing a “twin world” interaction logic:
| Interaction | Result | Effect in Simulation |
|---|---|---|
| m+ / m+ | Attraction | Standard galactic clumping |
| m- / m- | Attraction | Negative mass forms its own clusters |
| m+ / m- | Repulsion | Matter is pushed away |
Because the matter of opposite sign repel each other, the negative mass occupy the centers of large cosmic voids, acting as the Great Repeller and carving out the “soap bubble” distribution of galaxies.
Ensure your project has the following files:
index.html: The container with a <canvas> element.demo.js: The simulation logic.Simply open your cpu/index.html file in any modern web browser.
Simply open your gpu/index.html file in any modern web browser.
(make sure to enable WebGPU, e.g. chrome://flags/#enable-unsafe-webgpu).
Apache v2.