Starting with the Friedmann-Lemaitre-Robertson-Walker (FLRW) metric in geometrised units (where ) :
Where is the scale factor of the universe. When , is the Gaussian curvature.
We can calculate the component of the Einstein Tensor to be:
This was calculated using the Python code here.
We also know that the component of the Energy-Momentum Tensor is the energy density:
We can now substitute values into the Einstein Field Equation:
To get:
Where is the Hubble rate. In the present day, the Hubble rate is simply the Hubble constant and represents the rate at which the universe is expanding.
Converting from geometrised units we get:
Which is known as the first Friedmann Equation.
To get the equation used in the simulation, first we need to expand , the energy density:
Where is the current radiation density, is the current mass density and is the current vacuum density.
If we divide both sides of the Friedmann Equation by the Hubble constant squared, , we get:
Which can be simplified by defining coefficients called "Density Parameters":
Where and .
We can then rearrange the equation in terms of and (because ):
Now, the Euler Method can be used to numerically solve the above equation:
Here, .
This is the equation used in the simulation. Check it out!