... The Programmer God ...
A simulation universe hypothesis at the Planck scale




if we assign geometrical objects to mass, space and time,
and then link them via a unit number relationship, 
we can build a physical universe from mathematical structures.



The simulations mentioned in the article and on the wiki-site are given here. The code is written in C, I tried to keep it simple so non-C programmers can still follow the logic. The programs can run online (for example https://www.onlinegdb.com/, select C, copy paste the code, then select Run), but this tends to be limited and so more suitable for low radius (small kr), and small mass (small ipoints) simulations (i.e.: kr=4, ipoints=8). I use codeblocks for the C compiler. The code can be used under creative commons CC CC BY-NC-SA 4.0. This permits modifications to the code. I used gnuplot for the animations (example gnuplot code is given at the end of the program).

This page assumes that the reader is already familiar with the article and/or wiki page. The following sections refer to different aspects (2-body orbits, elliptical orbits, transition orbits ...), but the orbital section itself in each case is the same. I have separated them to keep the code readable.

The model is designed to represent events at the Planck scale and so the mathematics is simple but computationally intensive. The core concept behind this approach is that the universe does not require an external set of commands, rather it could be a geometrically autonomous computer; electrons orbit protons, not because of an external function (a set of pre-programmed rules as with our simulations), but due to geometrical imperatives, the respective geometries of the electron and proton lead to this result. The incremental expansion of the universe does the rest (as it expands it pulls the particles with it).

Variables (2-body orbits):
ipoints: number of points in the central mass (the Scwharzchild radius)
jpoints: total number of points
kr: sets orbital radius as multiples of ipoints (quantized radius)
x[0], y[0]: start coordinates for the orbiting point
x[1], y[1]: start coordinates for the central mass center point (some simulations have x[1], y[1] and x[2], y[2]).

The Kepler derivation in Maple code format.

Note: the simulation itself doesn't distingush between points, they all rotate around each other and so the points may also be assigned random co-ordinates for complex orbits. The 2-body orbit is however the most convenient for comparison with real-world orbits. Comments and suggestions are welcome, the code is not optimized, further improvements to the averaging and orbital stability can be added but these must still reflect the geometrical autonomy of the code. 




1. 2-body orbits

The simulation Gravitational-orbital-simulation-2body.c calculates a single point orbiting a central mass. The calculated period and length of orbit are then compared with the simulation data to confirm that the calculation formulas used accurately represent the orbital data. Once this is established, these formulas can then be applied to solving real world orbits. The Kepler derivation of G is also an example. kr = 32 is probably the maximum radius for long double precision.


2. 2-body elliptical orbits

The simulation gravitational-orbital-elliptical-orbits.cpp is the same program as above but with an extra function, orbitals can travel either clock-wise or anti-clockwise. By choosing the ratio of clock-wise:anti-clockwise orbitals the degree of eccentricity can be controlled. The ratio 108:1 gave an eccentricity close to Mercury. 
Variables:
kcurve //0 = circular, 1 = straight line, 9999... = circular
direction //(1 anticlockwise, -1 = clockwise)
cycle //number of orbits to repeat

To extrapolate to mass = infinity for comparison with Mercury's orbit Gravitational-orbital-ellipse-extrapolate.py was used.



3a. Hyperbolic spiral - Rydberg

The simulation H-orbital-Rydberg-atom.c calculates hyperbolic spiral n-levels for a Rydberg atom (a nucleus of point size and infinite mass).



3b. Hyperbolic spiral - electron-proton simulation

A 2-body gravitational orbit where the electron is the orbiting point and the proton as the central mass H-orbital-transition-spiral.cpp. An additional electron transition function is included. Also the rotation angle has an extra alpha component.




4. Orbital vs. Newton

A simple 3-body orbit was generated to compare this orbital model with a Newtonian generated orbit.
1. Newton-vs-Orbital_Orbital.py generates the data file data-3b-long.txt
2. Newton-vs-Orbital_Newton.py generates the corresponding orbit using the Newtonian leap-frog, as shown Newton-vs-Orbital-trajectory_comparison.png.