FLRW Cosmology Model

In this post, I would like to introduce the basic assumption of modern cosmology, i.e. the FLRW model, also as an application of Einstein field equation. The idea is simple, given a FLRW metric, plug into the field equation, then we deduce how the space scale \(a\) (which is a parameter of the metric) changes along with the \(t\) coordinates. Here I express the computation in a Python program. import sympy as sp from sympy.diffgeom import Manifold, Patch, CoordSystem, TensorProduct from sympy.diffgeom.diffgeom import metric_to_Ricci_components, metric_to_Christoffel_2nd from sympy import Symbol, Function, sin, simplify, Matrix # Define spacetime dimensions dim = 4 # Define manifold and coordinate system (using spherical coordinates) M = Manifold('M', dim) patch = Patch('P', M) coords = CoordSystem('coords', patch, [ Symbol('t', real=True), Symbol('r', real=True, positive=True), Symbol('theta', real=True, positive=True), Symbol('phi', real=True) ]) # Get coordinate functions and basic one-forms t, r, theta, phi = coords.coord_functions() dt, dr, dtheta, dphi = coords.base_oneforms() # Define scale factor and curvature parameter (using natural units c=1) a = Function('a')(t) # Scale factor as a function of time k = Symbol('k') # Spatial curvature parameter # Construct FLRW metric # ds² = -dt² + a(t)²[dr²/(1-kr²) + r²(dθ² + sin²θ dφ²)] g = -TensorProduct(dt, dt) + \ a**2 * (TensorProduct(dr, dr)/(1-k*r**2) + \ r**2 * TensorProduct(dtheta, dtheta) + \ r**2 * sin(theta)**2 * TensorProduct(dphi, dphi)) # Matrix form of the metric (for Einstein tensor calculation) g_matrix = Matrix([ [-1, 0, 0, 0], [0, a**2/(1-k*r**2), 0, 0], [0, 0, a**2*r**2, 0], [0, 0, 0, a**2*r**2*sin(theta)**2] ]) # Calculate Christoffel symbols Christoffel = metric_to_Christoffel_2nd(g) # Calculate Ricci tensor Ricci_tensor = metric_to_Ricci_components(g) # Define coordinate index names coord_names = ['t', 'r', 'θ', 'φ'] # Calculate inverse metric tensor g_inverse = Matrix([ [-1, 0, 0, 0], [0, (1-k*r**2)/a**2, 0, 0], [0, 0, 1/(a**2*r**2), 0], [0, 0, 0, 1/(a**2*r**2*sin(theta)**2)] ]) # Calculate Ricci scalar R = g^{μν} * R_{μν} Ricci_scalar = 0 for i in range(dim): for j in range(dim): Ricci_scalar += g_inverse[i, j] * Ricci_tensor[i, j] Ricci_scalar = simplify(Ricci_scalar) # Calculate Einstein tensor G_μν = R_μν - (1/2) * g_μν * R Einstein_tensor = Matrix([[0 for _ in range(dim)] for _ in range(dim)]) for i in range(dim): for j in range(dim): Einstein_tensor[i, j] = Ricci_tensor[i, j] - (1/2) * g_matrix[i, j] * Ricci_scalar Einstein_tensor[i, j] = simplify(Einstein_tensor[i, j]) # Print Christoffel symbols print("Christoffel symbols of FLRW metric (Γ^μ_νρ):") for i in range(dim): for j in range(dim): for k in range(dim): if Christoffel[i, j, k] != 0: print(f"Γ^{coord_names[i]}_{coord_names[j]}{coord_names[k]} = {simplify(Christoffel[i, j, k])}") # Print Ricci tensor print("\nRicci tensor of FLRW metric (R_μν):") for i in range(dim): for j in range(dim): if Ricci_tensor[i, j] != 0: print(f"R_{coord_names[i]}{coord_names[j]} = {simplify(Ricci_tensor[i, j])}") # Print Ricci scalar print("\nRicci scalar of FLRW metric (R):") print(f"R = {Ricci_scalar}") # Print Einstein tensor print("\nEinstein tensor of FLRW metric (G_μν):") for i in range(dim): for j in range(dim): if Einstein_tensor[i, j] != 0: print(f"G_{coord_names[i]}{coord_names[j]} = {Einstein_tensor[i, j]}") Christoffel symbols of FLRW metric (Γ^μ_νρ): Γ^t_rr = -a(t)*Subs(Derivative(a(_xi), _xi), _xi, t)/(k*r**2 - 1) Γ^t_θθ = a(t)*r**2*Subs(Derivative(a(_xi), _xi), _xi, t) Γ^t_φφ = a(t)*sin(theta)**2*r**2*Subs(Derivative(a(_xi), _xi), _xi, t) Γ^r_tr = Subs(Derivative(a(_xi), _xi), _xi, t)/a(t) Γ^r_rt = Subs(Derivative(a(_xi), _xi), _xi, t)/a(t) Γ^r_rr = -k*r/(k*r**2 - 1) Γ^r_θθ = k*r**3 - r Γ^r_φφ = (k*r**2 - 1)*sin(theta)**2*r Γ^θ_tθ = Subs(Derivative(a(_xi), _xi), _xi, t)/a(t) Γ^θ_rθ = 1/r Γ^θ_θt = Subs(Derivative(a(_xi), _xi), _xi, t)/a(t) Γ^θ_θr = 1/r Γ^θ_φφ = -sin(2*theta)/2 Γ^φ_tφ = Subs(Derivative(a(_xi), _xi), _xi, t)/a(t) Γ^φ_rφ = 1/r Γ^φ_θφ = 1/tan(theta) Γ^φ_φt = Subs(Derivative(a(_xi), _xi), _xi, t)/a(t) Γ^φ_φr = 1/r Γ^φ_φθ = 1/tan(theta) Ricci tensor of FLRW metric (R_μν): R_tt = -3*Subs(Derivative(a(_xi), (_xi, 2)), _xi, t)/a(t) R_rr = (-2*k - a(t)*Subs(Derivative(a(_xi), (_xi, 2)), _xi, t) - 2*Subs(Derivative(a(_xi), _xi), _xi, t)**2)/(k*r**2 - 1) R_θθ = (2*k + a(t)*Subs(Derivative(a(_xi), (_xi, 2)), _xi, t) + 2*Subs(Derivative(a(_xi), _xi), _xi, t)**2)*r**2 R_φφ = (2*k + a(t)*Subs(Derivative(a(_xi), (_xi, 2)), _xi, t) + 2*Subs(Derivative(a(_xi), _xi), _xi, t)**2)*sin(theta)**2*r**2 Ricci scalar of FLRW metric (R): R = 6*(k + a(t)*Subs(Derivative(a(_xi), (_xi, 2)), _xi, t) + Subs(Derivative(a(_xi), _xi), _xi, t)**2)/a(t)**2 Einstein tensor of FLRW metric (G_μν): G_tt = 3.0*(k + Subs(Derivative(a(_xi), _xi), _xi, t)**2)/a(t)**2 G_rr = (1.0*k + 2.0*a(t)*Subs(Derivative(a(_xi), (_xi, 2)), _xi, t) + 1.0*Subs(Derivative(a(_xi), _xi), _xi, t)**2)/(k*r**2 - 1) G_θθ = (-1.0*k - 2.0*a(t)*Subs(Derivative(a(_xi), (_xi, 2)), _xi, t) - 1.0*Subs(Derivative(a(_xi), _xi), _xi, t)**2)*r**2 G_φφ = (-1.0*k - 2.0*a(t)*Subs(Derivative(a(_xi), (_xi, 2)), _xi, t) - 1.0*Subs(Derivative(a(_xi), _xi), _xi, t)**2)*sin(theta)**2*r**2 Plug in the final Einstein tensor into the Einstein equation. Let’s take \( G_{tt} \) as an example: ...

April 13, 2025

Einstein Field Equation

To derive the Einstein field equation, we start from physical considerations involving energy and momentum, and geometry considerations from the curvature of spacetime. The Einstein field equation relies on three fundamental assumptions: Energy conservation Momentum conservation Newtonian gravity equation For assumptions 1 and 2, the conservation law for the stress-energy tensor holds: \[ \nabla_\mu T^{\mu \nu} = 0 \]The stress-energy tensor \(T^{\mu \nu}\) encapsulates crucial physical quantities and is expressed as: ...

March 7, 2025

Some Basics of Differential Geometry 3

In this post, I would like to study some basic knowledge of the \( \nabla \) symbol, as well as an important formula related with riemann tensor. I. Connection Definition: A connection \( \nabla \) on a smooth manifold \( (M, \mathcal{O}) \) is a map that takes a pair consisting of a vector field \( X \) and a \( (p, q) \)-tensor field \( T \) and sends them to a \( (p, q) \)-tensor field \( \nabla_X T \), satisfying: ...

February 7, 2025

Some Basics of Differential Geometry 2

In this post, we will delve deeper into the concepts of differential geometry, mainly focusing on the notion of riemann tensor, ricci tensor, and ricci scalar. I. The Riemann Tensor A. Definition We start with a \(d\)-dimensional manifold \(M\) endowed with a (pseudo-)Riemannian metric \(g_{\mu\nu}\). The connection compatible with the metric is the Levi-Civita connection \(\nabla\). The Riemann curvature tensor (often called simply the Riemann tensor) \(R^\rho_{\ \sigma\mu\nu}\) is defined by the commutator of covariant derivatives acting on a vector field \(V^\rho\): ...

January 28, 2025

Some Basics of Differential Geometry

In this post, I would like to build some basics of differential geometry for understanding the Einstein Field Equations. 1. Riemann Tensor and Its Properties Definition of the Riemann Tensor: The Riemann curvature tensor \( R^i_{jkl} \) is a fundamental object in differential geometry, representing the intrinsic curvature of a manifold. It is defined as: \[ R^i_{jkl} = \partial_k \Gamma^i_{jl} - \partial_l \Gamma^i_{jk} + \Gamma^i_{km} \Gamma^m_{jl} - \Gamma^i_{lm} \Gamma^m_{jk} \] where \( \Gamma^i_{jk} \) are the Christoffel symbols. ...

January 21, 2025

Stress-Energy Tensor

In this post, I would like to build some fundational knowledge about the Einstein Field Equations. First, I will pose several questions based on the last post about cosmology: What are the einstein tensor and the stress-energy tensor? How is Einstein Field Equations derived? In the context of cosmology, what is the perfect fluid approximation? How can we derive the Friedmann Equation and Acceleration Equation from the Einstein Field Equations? We refer to this course. ...

January 4, 2025

Inflation Cosmology: Is our universe part of a multiuniverse?

I want to learn about cosmology, maybe start with the book “An Introduction to Modern Cosmology” by Andrew Liddle and the lecture “The Early Universe” by MIT OpenCourseWare. The standard Big Bang It does not tell the cause of the Bang, but the aftermath of the Bang. It assumes all the matter already existed before the Bang. Cosmic Inflation A prequal to the Big Bang. gravity can be repulsive when pressure is negative. (Find out more about the relationship between gravity and pressure in the next part.) There is a patch of repulsive gravity material in the early universe, which is the cause of the Big Bang. The (mass/energy) density of the repulsive material is not lowered as it expands.The resolution is to introduce negative energy. Complementarity: The relationship between gravity and pressure Below is a high-level introduction to these ideas, followed by some of the key formulas in cosmology and general relativity that show why negative pressure can produce a repulsive gravitational effect. ...

December 23, 2024