Tutorial: FLRW Cosmology

This tutorial demonstrates a particular example of the symbolic tools in pystein. For other tutorials see all tutorials.

The pystein.metric module has several well-known metrics predefined. We will use the Friedman-Lemaitre-Roberston-Walker (FLRW) metric for this tutorial:

from pystein import metric, gravity
from pystein import utilities

flrw = metric.flrw().subs({'c': 1})
flrw

We can use the gravity module to compute the einstein equation components:

efe_00 = utilities.full_simplify(gravity.einstein_equation(0, 0, flrw))
efe_00

The metric module contains a utility for simplifying the notation used for derivatives in sympy, which we’ll use to recover the familiar Friedmann equation:

metric.simplify_deriv_notation(efe_00, flrw, use_dots=True)