A Mathematica library for tensor calculus and dynamical evolution in General Relativity. As an example, let’s try to calculate the curvature tensors in an expanding universe. In order to do that, we need to define a metric and a set of coordinates. An isotropic and homogeneous universe is described by the Friedmann-Robertson-Walker metric. In spherical coordinates, this is
2
ds
2
dt
2
a
2
dr
1-
2
kr
2
r
2
dθ
2
sin
2
dϕ
We first load the Curvatura Package:
In[]:=
Needs["Curvatura`"]
Then, we define the FRW metric as a (4,4) tensor
In[]:=
g={{-1,0,0,0},{0,a[t]^2/(1-kr^2),0,0},{0,0,a[t]^2r^2,0},{0,0,0,a[t]^2r^2Sin[θ]^2}}
Out[]=
{-1,0,0,0},0,,0,0,{0,0,,0},{0,0,0,}
2
a[t]
1-k
2
r
2
r
2
a[t]
2
r
2
a[t]
2
Sin[θ]
and the spherical coordinates the metric is written in
In[]:=
x={t,r,θ,ϕ};
We can now compute the connection coefficients (Christoffel symbols) using the pre-defined function Connection[g,x]:
In[]:=
MatrixForm[Connection[g,x],TableDepth2]
Out[]//MatrixForm=
{0,0,0,0} | 0, a[t] ′ a 1-k 2 r | {0,0, 2 r ′ a | {0,0,0, 2 r 2 Sin[θ] ′ a |
0, ′ a a[t] | ′ a a[t] kr 1-k 2 r | {0,0,r(-1+k 2 r | {0,0,0,r(-1+k 2 r 2 Sin[θ] |
0,0, ′ a a[t] | 0,0, 1 r | ′ a a[t] 1 r | {0,0,0,-Cos[θ]Sin[θ]} |
0,0,0, ′ a a[t] | 0,0,0, 1 r | {0,0,0,Cot[θ]} | ′ a a[t] 1 r |
We do the same for the Ricci tensor
In[]:=
RicciTensor[g,x]//MatrixForm
Out[]//MatrixForm=
- 3 ′′ a a[t] | 0 | 0 | 0 |
0 | 2(k+ 2 ′ a ′′ a 1-k 2 r | 0 | 0 |
0 | 0 | 2 r 2 ′ a ′′ a | 0 |
0 | 0 | 0 | 2 r 2 Sin[θ] 2 ′ a ′′ a |
and the Einstein tensor
In[]:=
EinsteinTensor[g,x]//MatrixForm
Out[]//MatrixForm=
3(k+ 2 ′ a 2 a[t] | 0 | 0 | 0 |
0 | k+ 2 ′ a ′′ a -1+k 2 r | 0 | 0 |
0 | 0 | - 2 r 2 ′ a ′′ a | 0 |
0 | 0 | 0 | - 2 r 2 Sin[θ] 2 ′ a ′′ a |
We can also check explicitly that the contraction of the Riemann curvature tensor gives the Ricci tensor :
=
R
ab
c
R
acb
In[]:=
TensorContract[RiemannTensor[g,x],{1,3}]==RicciTensor[g,x]//FullSimplify
Out[]=
True
The Weyl curvature tensor vanishes identically in any conformally flat metric, and we can check this explicitly for FRW by using the relevant function:
In[]:=
WeylTensor[g,x]==ConstantArray[0,{4,4,4,4}]//FullSimplify
Out[]=
True
We can also calculate the Kretschmann scalar for the FRW metric:
In[]:=
KretschmannScalar[g,x]
Out[]=
12(+[t])
2
(k+[t])
2
′
a
2
a[t]
2
′′
a
4
a[t]
The Singularity function returns all the singular points of the spacetime described by the metric . In the FRW spacetime, there is one gravitational singularity at , corresponding to the Big Bang:
g
a(t)=0
In[]:=
Singularity[g,x]
Out[]=
a[t]0
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
Curvatura: a library for tensor calculus and dynamical evolution in general relativity
by Andrea Palessandro
Wolfram Community, STAFF PICKS, November 25, 2024
https://community.wolfram.com/groups/-/m/t/3328470
by Andrea Palessandro
Wolfram Community, STAFF PICKS, November 25, 2024
https://community.wolfram.com/groups/-/m/t/3328470