Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

133957 views
License: OTHER
%auto typeset_mode(True, display=False)

Friedmann equations

This worksheet demonstrates a few capabilities of SageManifolds (version 0.8) in computations regarding cosmological spacetimes with Friedmann-Lemaître-Robertson-Walker (FLRW) metrics.

It is released under the GNU General Public License version 3.

(c) Michal Bejger, Eric Gourgoulhon (2015)

The corresponding worksheet file can be downloaded from here.

We declare the spacetime M as a 4-dimensional manifold:

M = Manifold(4, 'M')

We introduce the standard FLRW coordinates:

fr.<t,r,th,ph> = M.chart(r't r:[0,+oo) th:[0,pi]:\theta ph:[0,2*pi):\phi') fr
$\left(M,(t, r, {\theta}, {\phi})\right)$

Assuming that the speed of light c=1, let us define a few variables: Newton's constant $G$, the cosmological constant $\Lambda$, the spatial curvature constant $k$, the scale factor $a(t)$, the fluid proper density $\rho$ and the fluid pressure $p$:

var('G, Lambda, k') a = M.scalar_field(function('a', t), name='a') rho = M.scalar_field(function('rho', t), name='rho') p = M.scalar_field(function('p', t), name='p')
($G$, $\Lambda$, $k$)

The FLRW metric is defined by its components:

g = M.lorentz_metric('g') g[0,0] = -1 g[1,1] = a*a/(1 - k*r^2) g[2,2] = a*a*r^2 g[3,3] = a*a*(r*sin(th))^2 g.display()
$g = -\mathrm{d} t\otimes \mathrm{d} t + \left( -\frac{a\left(t\right)^{2}}{k r^{2} - 1} \right) \mathrm{d} r\otimes \mathrm{d} r + r^{2} a\left(t\right)^{2} \mathrm{d} {\theta}\otimes \mathrm{d} {\theta} + r^{2} a\left(t\right)^{2} \sin\left({\theta}\right)^{2} \mathrm{d} {\phi}\otimes \mathrm{d} {\phi}$

A matrix view of the metric components:

g[:]
$\left(\begin{array}{rrrr} -1 & 0 & 0 & 0 \\ 0 & -\frac{a\left(t\right)^{2}}{k r^{2} - 1} & 0 & 0 \\ 0 & 0 & r^{2} a\left(t\right)^{2} & 0 \\ 0 & 0 & 0 & r^{2} a\left(t\right)^{2} \sin\left({\theta}\right)^{2} \end{array}\right)$

The Levi-Civita connection associated with the metric is computed:

nab = g.connection() g.christoffel_symbols_display()
$\begin{array}{lcl} \Gamma_{ \phantom{\, t } \, r \, r }^{ \, t \phantom{\, r } \phantom{\, r } } & = & -\frac{a\left(t\right) \frac{\partial\,a}{\partial t}}{k r^{2} - 1} \\ \Gamma_{ \phantom{\, t } \, {\theta} \, {\theta} }^{ \, t \phantom{\, {\theta} } \phantom{\, {\theta} } } & = & r^{2} a\left(t\right) \frac{\partial\,a}{\partial t} \\ \Gamma_{ \phantom{\, t } \, {\phi} \, {\phi} }^{ \, t \phantom{\, {\phi} } \phantom{\, {\phi} } } & = & r^{2} a\left(t\right) \sin\left({\theta}\right)^{2} \frac{\partial\,a}{\partial t} \\ \Gamma_{ \phantom{\, r } \, t \, r }^{ \, r \phantom{\, t } \phantom{\, r } } & = & \frac{\frac{\partial\,a}{\partial t}}{a\left(t\right)} \\ \Gamma_{ \phantom{\, r } \, r \, r }^{ \, r \phantom{\, r } \phantom{\, r } } & = & -\frac{k r}{k r^{2} - 1} \\ \Gamma_{ \phantom{\, r } \, {\theta} \, {\theta} }^{ \, r \phantom{\, {\theta} } \phantom{\, {\theta} } } & = & k r^{3} - r \\ \Gamma_{ \phantom{\, r } \, {\phi} \, {\phi} }^{ \, r \phantom{\, {\phi} } \phantom{\, {\phi} } } & = & {\left(k r^{3} - r\right)} \sin\left({\theta}\right)^{2} \\ \Gamma_{ \phantom{\, {\theta} } \, t \, {\theta} }^{ \, {\theta} \phantom{\, t } \phantom{\, {\theta} } } & = & \frac{\frac{\partial\,a}{\partial t}}{a\left(t\right)} \\ \Gamma_{ \phantom{\, {\theta} } \, r \, {\theta} }^{ \, {\theta} \phantom{\, r } \phantom{\, {\theta} } } & = & \frac{1}{r} \\ \Gamma_{ \phantom{\, {\theta} } \, {\phi} \, {\phi} }^{ \, {\theta} \phantom{\, {\phi} } \phantom{\, {\phi} } } & = & -\cos\left({\theta}\right) \sin\left({\theta}\right) \\ \Gamma_{ \phantom{\, {\phi} } \, t \, {\phi} }^{ \, {\phi} \phantom{\, t } \phantom{\, {\phi} } } & = & \frac{\frac{\partial\,a}{\partial t}}{a\left(t\right)} \\ \Gamma_{ \phantom{\, {\phi} } \, r \, {\phi} }^{ \, {\phi} \phantom{\, r } \phantom{\, {\phi} } } & = & \frac{1}{r} \\ \Gamma_{ \phantom{\, {\phi} } \, {\theta} \, {\phi} }^{ \, {\phi} \phantom{\, {\theta} } \phantom{\, {\phi} } } & = & \frac{\cos\left({\theta}\right)}{\sin\left({\theta}\right)} \end{array}$
Ricci tensor:
Ricci = nab.ricci() Ricci.display()
$\mathrm{Ric}\left(g\right) = -\frac{3 \, \frac{\partial^2\,a}{\partial t^2}}{a\left(t\right)} \mathrm{d} t\otimes \mathrm{d} t + \left( -\frac{2 \, \left(\frac{\partial\,a}{\partial t}\right)^{2} + a\left(t\right) \frac{\partial^2\,a}{\partial t^2} + 2 \, k}{k r^{2} - 1} \right) \mathrm{d} r\otimes \mathrm{d} r + \left( 2 \, r^{2} \left(\frac{\partial\,a}{\partial t}\right)^{2} + r^{2} a\left(t\right) \frac{\partial^2\,a}{\partial t^2} + 2 \, k r^{2} \right) \mathrm{d} {\theta}\otimes \mathrm{d} {\theta} + {\left(2 \, r^{2} \left(\frac{\partial\,a}{\partial t}\right)^{2} + r^{2} a\left(t\right) \frac{\partial^2\,a}{\partial t^2} + 2 \, k r^{2}\right)} \sin\left({\theta}\right)^{2} \mathrm{d} {\phi}\otimes \mathrm{d} {\phi}$

Ricci scalar ($R^\mu_{\ \, \mu}$):

Ricci_scalar = g.ricci_scalar() Ricci_scalar.display()
$\begin{array}{llcl} \mathrm{r}\left(g\right):& M & \longrightarrow & \mathbb{R} \\ & \left(t, r, {\theta}, {\phi}\right) & \longmapsto & \frac{6 \, {\left(\left(\frac{\partial\,a}{\partial t}\right)^{2} + a\left(t\right) \frac{\partial^2\,a}{\partial t^2} + k\right)}}{a\left(t\right)^{2}} \end{array}$

The fluid 4-velocity:

u = M.vector_field('u') u[0] = 1 u.display()
$u = \frac{\partial}{\partial t }$
g(u,u).expr()
$-1$

Perfect fluid energy-momentum tensor $T$:

u_form = u.down(g) # the 1-form associated to u by metric duality T = (rho+p)*(u_form*u_form) + p*g T.set_name('T') print T T.display()
field of symmetric bilinear forms 'T' on the 4-dimensional manifold 'M'
$T = \rho\left(t\right) \mathrm{d} t\otimes \mathrm{d} t + \left( -\frac{a\left(t\right)^{2} p\left(t\right)}{k r^{2} - 1} \right) \mathrm{d} r\otimes \mathrm{d} r + r^{2} a\left(t\right)^{2} p\left(t\right) \mathrm{d} {\theta}\otimes \mathrm{d} {\theta} + r^{2} a\left(t\right)^{2} p\left(t\right) \sin\left({\theta}\right)^{2} \mathrm{d} {\phi}\otimes \mathrm{d} {\phi}$

The trace of $T$ (we use index notation to denote the double contraction $g^{ab} T_{ab}$):

Ttrace = g.inverse()['^ab']*T['_ab'] Ttrace.display()
$\begin{array}{llcl} & M & \longrightarrow & \mathbb{R} \\ & \left(t, r, {\theta}, {\phi}\right) & \longmapsto & 3 \, p\left(t\right) - \rho\left(t\right) \end{array}$

Einstein equation: $R_{\mu \nu} - {1 \over 2} R g_{\mu \nu} + \Lambda g_{\mu \nu} = {8 \pi G} T_{\mu \nu}$

E1 = Ricci - Ricci_scalar/2*g + Lambda*g - (8*pi*G)*T print "First Friedmann equation:\n" E1[0,0].expr().expand() == 0
First Friedmann equation:
$-8 \, \pi G \rho\left(t\right) - \Lambda + \frac{3 \, D[0]\left(a\right)\left(t\right)^{2}}{a\left(t\right)^{2}} + \frac{3 \, k}{a\left(t\right)^{2}} = 0$

Trace-reversed version of the Einstein equation: $R_{\mu \nu} - \Lambda g_{\mu \nu} = {8 \pi G} \left(T_{\mu \nu} - {1 \over 2}T\,g_{\mu \nu}\right)$

E2 = Ricci - Lambda*g - (8*pi*G)*(T - Ttrace/2*g) print "Second Friedmann equation:\n" E2[0,0].expr().expand() == 0
Second Friedmann equation:
$-12 \, \pi G p\left(t\right) - 4 \, \pi G \rho\left(t\right) + \Lambda - \frac{3 \, D[0, 0]\left(a\right)\left(t\right)}{a\left(t\right)} = 0$