U02_ComputerLab_CurvatureWithMathematica_Mathematica
U02_ComputerLab_CurvatureWithMathematica_Mathematica
The code in this notebook is based on James Hartle’s Mathematica programs written as companions to
his book “Gravity: An Introduction to Einstein’s General Relativity”, available from the Book’s site:
http://web.physics.ucsb.edu/~gravitybook/mathematica.html
The original program was written by Leonard Parker, University of Wisconsin, Milwaukee (see the
Acknowledgement section in the end of this notebook). The code in this notebook is a modification of
the original program, adapted for the needs of the course “General Relativity and Cosmology” offered
at the National Technical University of Athens, by Konstantinos Anagnostopoulos (
http://physics.ntua.gr/konstant ).The site of the course for the Spring 2023 can be found at
http://physics.ntua.gr/konstant/GR .
This is the Mathematica notebook Curvature and the Einstein Equation available from the book website.
From a given metric gαβ , it computes the components of the following: the inverse metric, gλσ , the
Christoffel symbols or affine connection,
Γλ μν = 2 gλσ ∂μ gσν + ∂ν gσμ - ∂σ gμν ,
1
We also compute:
Rμνρσ , Rμνρσ , R2 = Rμνρσ Rμνρσ , the Weyl Tensor
ℭρσμν = Rρσμν - gρ[μ Rν] σ - gσ[μ Rν] ρ +
2 2
n-2 (n-1) (n-2)
gρ[μ gν] σ R,
and the geodesic equations.
You must input the covariant components of the metric tensor gμν by editing the relevant input line in
this Mathematica notebook. You may also wish to change the names of the coordinates. Only the
nonzero components of the above quantities are displayed as the output. All the components
computed are in the coordinate basis in which the metric was specified.
Initialization:
First clear any values that may already have been assigned to the names of the various objects to be
calculated. The names of the coordinates that you will use are also cleared. The name of the
2
coordinates must be defined (the list coord), and then the dimension of the manifold n is set.
Note:
It is important not to use the symbols, i, j, k, l, s, R, G, ℭ, τ , Γ, or n as constants or coordinates in the
metric that you specify above. The reason is that the first five of those symbols are used as summation
or table indices in the calculations done below, and n is the dimension of the space. The rest are also
used for displaying results in the program.
(*----------------------------------------------------------------------------*)
(* This is what you need to set + the metric below: *)
coord = {t, χ , θ, ϕ};
n = Length[coord];
(*----------------------------------------------------------------------------*)
Print["The Manifold has dimension n= ",
n, "\nCoordinate system: ", coord]
In[ ]:=
(*----------------------------------------------------------------------------*)
metric =
{- 1, 0 ,0 , 0},
0, a[t] , 0 2
, 0,
0, 0 2
, a[t] Sin[χ] , 2
0,
0, 0 ,0 , a[t] Sin[χ] Sin[θ] ;
2 2 2
(*----------------------------------------------------------------------------*)
metric // MatrixForm
Out[ ]//MatrixForm=
-1 0 0 0
2
0 a[t] 0 0
2 2
0 0 a[t] Sin[χ] 0
0 0 0 a[t]2 Sin[θ]2 Sin[χ]2
-1 0 0 0
1
0 0 0
a[t]2
Csc[χ]2
0 0 0
a[t]2
Cscθ Csc[χ]2
2
0 0 0
a[t]2
Out[ ]= a[t]2
Out[ ]= t
Use the list of coordinates to specify the variable w.r.t. which we differentiate:
4
Out[ ]= 0, 2 a[t] a′ [t], 2 a[t] Sin[χ]2 a′ [t], 2 a[t] Sin[θ]2 Sin[χ]2 a′ [t]
Out[ ]= {0, 0, 0, 0}, {2 a[t] a′ [t], 0, 0, 0}, 2 a[t] Sin[χ]2 a′ [t], 2 a[t]2 Cos[χ] Sin[χ], 0, 0,
2 a[t] Sin[θ]2 Sin[χ]2 a′ [t], 2 a[t]2 Cos[χ] Sin[θ]2 Sin[χ], 2 a[t]2 Cos[θ] Sin[θ] Sin[χ]2, 0
The delayed definition performs a calculation on demand and caches the result:
E.g.: pi2:=pi2=N[Pi^2,50];
fib[1]=fib[2]=1;
fib[n_]:=fib[n]=fib[n-1]+fib[n-2]
fib[6] → 8
Definition[fib]
fib[1] = 1
fib[2] = 1
fib[3] = 2
fib[4] = 3
fib[5] = 5
fib[6] = 8
fib[n_] := fib[n] = fib[n - 1] + fib[n - 2]
5
Now let’s see how to display the nontrivial results. First let’s look what affine consists of:
Out[ ]= {0, 0, 0, 0}, {0, a[t] a′ [t], 0, 0}, 0, 0, a[t] Sin[χ]2 a′ [t], 0,
a′ [t] a′ [t]
0, 0, 0, a[t] Sin[θ]2 Sin[χ]2 a′ [t], 0, , 0, 0, , 0, 0, 0,
a[t] a[t]
{0, 0, - Cos[χ] Sin[χ], 0}, 0, 0, 0, - Cos[χ] Sin[θ]2 Sin[χ],
a′ [t] a′ [t]
0, 0, , 0, {0, 0, Cot[χ], 0}, , Cot[χ], 0, 0, {0, 0, 0, - Cos[θ] Sin[θ]},
a[t] a[t]
a′ [t] a′ [t]
0, 0, 0, , {0, 0, 0, Cot[χ]}, {0, 0, 0, Cot[θ]}, , Cot[χ], Cot[θ], 0
a[t] a[t]
0 0 0 0
0 a[t] a′ [t] 0 0
Out[ ]= ,
0 0 a[t] Sin[χ]2 a′ [t] 0
0 0 0 a[t] Sin[θ]2 Sin[χ]2 a′ [t]
a′ [t]
0 a[t]
0 0
′
a [t]
a[t]
0 0 0 ,
0 0 - Cos[χ] Sin[χ] 0
0 0 0 - Cos[χ] Sin[θ]2 Sin[χ]
a′ [t] a′ [t]
0 0 a[t]
0 0 0 0 a[t]
0 0 Cot[χ] 0 0 0 0 Cot[χ]
a′ [t]
,
Cot[χ] 0 0 0 0 0 Cot[θ]
a[t] a′ [t]
0 0 0 - Cos[θ] Sin[θ] a[t]
Cot[χ] Cot[θ] 0
6
Many zeroes... We also need to associate the nonzero values with the indices μ , ν , ρ . Let’s make pairs of
values and Γμ νρ symbols:
We use the functions Superscript[Γ, i] → Γi , and Subscript[A, j, k] → Aj,k . The function
UnsameQ[<expression>,0] evaluates to True, when <expression> is not the same as 0.
If[<condition>,<value>] returns <value> when <condition> is True and Null when it is False:
Out[ ]= {Null}, Null, Γ12,2, a[t] a′ [t], Null, Null, Γ13,3, a[t] Sin[χ]2 a′ [t],
a′ [t]
Null, Null, Null, Γ14,4, a[t] Sin[θ]2 Sin[χ]2 a′ [t], {Null}, Γ22,1, , Null,
a[t]
Null, Null, Γ23,3, - Cos[χ] Sin[χ], Null, Null, Null, Γ24,4, - Cos[χ] Sin[θ]2 Sin[χ],
a′ [t]
{Null}, {Null, Null}, Γ33,1, , Γ33,2, Cot[χ], Null,
a[t]
Null, Null, Null, Γ34,4, - Cos[θ] Sin[θ], {Null}, {Null, Null},
a′ [t]
{Null, Null, Null}, Γ44,1, , Γ44,2, Cot[χ], Γ44,3, Cot[θ], Null
a[t]
Now we want to get rid of the Nulls: First Flatten the list:
Out[ ]= Null, Null, Γ12,2, a[t] a′ [t], Null, Null, Γ13,3, a[t] Sin[χ]2 a′ [t], Null, Null,
a′ [t]
Null, Γ14,4, a[t] Sin[θ]2 Sin[χ]2 a′ [t], Null, Γ22,1, , Null, Null, Null, Γ23,3,
a[t]
- Cos[χ] Sin[χ], Null, Null, Null, Γ24,4, - Cos[χ] Sin[θ]2 Sin[χ], Null, Null, Null,
a′ [t]
Γ33,1, , Γ33,2, Cot[χ], Null, Null, Null, Null, Γ34,4, - Cos[θ] Sin[θ], Null,
a[t]
a′ [t]
Null, Null, Null, Null, Null, Γ44,1, , Γ44,2, Cot[χ], Γ44,3, Cot[θ], Null
a[t]
Out[ ]= Γ12,2, a[t] a′ [t], Γ13,3, a[t] Sin[χ]2 a′ [t], Γ14,4, a[t] Sin[θ]2 Sin[χ]2 a′ [t],
a′ [t] a′ [t]
Γ22,1, , Γ23,3, - Cos[χ] Sin[χ], Γ24,4, - Cos[χ] Sin[θ]2 Sin[χ], Γ33,1, ,
a[t] a[t]
a′ [t]
Γ33,2, Cot[χ], Γ34,4, - Cos[θ] Sin[θ], Γ44,1, , Γ44,2, Cot[χ], Γ44,3, Cot[θ]
a[t]
Out[ ]= Γ12,2, a[t] a′ [t], Γ13,3, a[t] Sin[χ]2 a′ [t], Γ14,4, a[t] Sin[θ]2 Sin[χ]2 a′ [t],
a′ [t] a′ [t]
Γ22,1, , Γ23,3, - Cos[χ] Sin[χ], Γ24,4, - Cos[χ] Sin[θ]2 Sin[χ], Γ33,1, ,
a[t] a[t]
a′ [t]
Γ33,2, Cot[χ], Γ34,4, - Cos[θ] Sin[θ], Γ44,1, , Γ44,2, Cot[χ], Γ44,3, Cot[θ]
a[t]
Γ33,2 Cot[χ]
Γ34,4 - Cos[θ] Sin[θ]
a′ [t]
Γ44,1
a[t]
Γ44,2 Cot[χ]
Γ 4
4,3 Cot[θ]
Or use more spacing for more comfortable reading: TableSpacing → {yspaces, xspaces} adds spaces in
rows+columns
8
a′ [t]
Γ22,1
a[t]
a′ [t]
Γ33,1
a[t]
Γ33,2 Cot[χ]
a′ [t]
Γ44,1
a[t]
Γ44,2 Cot[χ]
Γ44,3 Cot[θ]
R32,3,2 1 + a′ [t]2
R42,4,2 1 + a′ [t]2
a′′ [t]
0 a[t]
0 0 0 0 0 0 0 0 0 0
′′
a [t]
0 0 , 0 0 0 0 0 0 Sin[χ] 1 + a′ [t]2
2
0
- a[t]
0 , ,
0 0 0 0 0 - Sin[χ]2 1 + a′ [t]2 0 0
0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 Sin[θ] Sin[χ]2 1 + a′ [t]2
2
,
0 0 0 0
0 - Sin[θ]2 Sin[χ]2 1 + a′ [t]2 0 0
a′′ [t]
0 0 a[t]
0 0 0 0 0 0 0 0 0
′ 2
0 0 0 0 0 0 - 1 - a [t] 0 0 0 0 0
a′′ [t]
, , ,
- 0 0 0 0 1 + a′ [t]2 0 0 0 0 0 0
a[t]
0 0 0 0 0 0 0 0
0 0 0 0
a′′ [t]
0 0 0 0 0 0 0 a[t]
0 0 0 0 0 0 0 0
, ,
0 0 0 Sin[θ]2 Sin[χ]2 1 + a′ [t]2 0 0 0 0
′′
0 0 - Sin[θ]2 Sin[χ]2 1 + a′ [t]2 0 -
a [t]
0 0 0
a[t]
0 0 0 0 0 0 0 0 0 0 0 0
′ 2 0 0 0 0
0 0 0 - 1 - a [t] 0 0 0 0
, ,
0 0 0 0 0 0 0 - Sin[χ]2 1 + a′ [t]2 0 0 0 0
0 1 + a′ [t]2 0 0 0 0 Sin[χ] 1 + a [t]
2 ′ 2
0 0 0 0 0
-
a [t]
0 0 0 0 1 + a′ [t]2 0 0 0 0 Sin[χ]2 1 + a′ [t]2 0
a[t]
Out[ ]//TableForm=
0 0 0 0 0 - a[t] a′′
′′
0 0 0 0 a[t] a [t] 0
0 0 0 0 0 0
0 0 0 0 0 0
0 a[t] a′′ [t] 0 0 0 0 0 0
- a[t] a′′ [t] 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 a[t] Sin[θ]2 Sin[χ]2 a′′ [t] 0 0 0
0 0 0 0 0 0 0 -a
0 0 0 0 0 0 0
- a[t] Sin[θ]2 Sin[χ]2 a′′ [t] 0 0 0 0 a[t]2 Sin[θ]2 Sin[χ]2 1 + a′ [t]2 0
2
23 Csc[χ]2 1+a′ [t]2
R3
a[t]6
Out[ ]=
a[t]4
3 a′′ [t]
R1,1 -
a[t]
3 a′′ [t]
- 0 0 0
a[t]
A vanishing table (as with the Schwarzschild metric example) means that the vacuum Einstein
equation is satisfied.
In[ ]:= scalar = FullSimplify[Sum[inversemetric〚i, j〛 ricci〚i, j〛, {i, 1, n}, {j, 1, n}] ]
3 1+a′ [t]2
G1,1
a[t]2
3 1+a′ [t]2
0 0 0
a[t]2
Ifn > 3,
lriemann〚i, j, k, l〛
1
- (metric〚i, k〛 ricci〚l, j〛 - metric〚i, l〛 ricci〚k, j〛 -
n-2
metric〚j, k〛 ricci〚l, i〛 + metric〚j, l〛 ricci〚k, i〛)
1
+ (metric〚i, k〛 metric〚l, j〛 - metric〚i, l〛 metric〚k, j〛) scalar
(n - 1) (n - 2)
(*else, if n≤ 3 return 0:*), 0,
listweyl := Table[
If[
UnsameQ[weyl〚i, j, k, l〛, 0],
{Subscript[ℭ, i, j, k, l], weyl〚i, j, k, l〛}
] , {i, 1, n}, {j, 1, i - 1}, {k, 1, n}, {l, 1, k - 1}];
TableForm[Partition[DeleteCases[Flatten[listweyl], Null], 2], TableSpacing → {2, 2}]
Out[ ]//TableForm=
{}
And here they are displayed as differential equations for the coordinates. τ is the affine parameter.
17
2 tτ θτ a′ [t]
θττ + - Cos[θ] Sin[θ] ϕτ2 + 2 Cot[χ] θτ χτ + = 0
a[t]
The Sphere S2
We use coordinates (θ, ϕ), and the metric:
(*----------------------------------------------------------------------------*)
(* This is what you need to set: *)
coord = {θ, ϕ};
n = Length[coord];
metric =
{1, 0 },
0, Sin[θ]
2
;
(*----------------------------------------------------------------------------*)
inversemetric = FullSimplify[Inverse[metric]];
Print["----------------------------------------------------------------------- "];
Print["The Manifold has dimension n= ",
n, "\nCoordinate system: ", coord];
Print["----------------------------------------------------------------------- "];
Print["gμν =", metric // MatrixForm];
Print["gμν =", inversemetric // MatrixForm];
affine := affine = FullSimplifyTable
18
(1 / 2) * Sum
(* gis ∂kgsj+∂jgsk-∂sgjk *)
(inversemetric〚i, s〛) *
(D[metric〚s, j〛, coord〚k〛 ] +
D[metric〚s, k〛, coord〚j〛 ] - D[metric〚j, k〛, coord〚s〛 ]),
{s, 1, n},
{i, 1, n}, {j, 1, n}, {k, 1, n} ;
(*The non zero Christoffel symbols are computed and selected below: *)
listaffine := Table[
If[
UnsameQ[affine〚i, j, k〛, 0],
{Subscript[Superscript[Γ, i], j, k], affine〚i, j, k〛}
],
{i, 1, n}, {j, 1, n}, {k, 1, j}];
Print["----------------------------------------------------------------------- "];
Print["Christoffel Symbols:"];
Print[TableForm[
Partition[DeleteCases[Flatten[listaffine], Null], 2], TableSpacing → {2, 2}]];
riemann := riemann = FullSimplifyTable
(* Rijkl= ∂kΓilj - ∂lΓikj*)
D[ affine〚i, l, j〛, coord〚k〛 ] - D[affine〚i, k, j〛, coord〚l〛 ]+
(* Γ i
ks Γs
lj - Γ i
ls Γ
s
kj *)
Sum[affine〚i, k, s〛 affine〚s, l, j〛 - affine〚i, l, s〛 affine〚s, k, j〛 ,
{s, 1, n}],
{i, 1, n}, {j, 1, n}, {k, 1, n}, {l, 1, n} ;
listriemann := Table[
If[
UnsameQ[riemann〚i, j, k, l〛, 0],
{Subscript[Superscript[R, i], j, k, l], riemann〚i, j, k, l〛}
],
{i, 1, n}, {j, 1, n}, {k, 1, n}, {l, 1, k - 1}];
Print["----------------------------------------------------------------------- "];
Print["Riemann Tensor:"];
Print[TableForm[
Partition[DeleteCases[Flatten[listriemann], Null], 2], TableSpacing → {2, 2}]];
lriemann := lriemann = FullSimplify[Table[
Sum[metric〚i, ii〛 riemann〚ii, j, k, l〛, {ii, 1, n}],
{i, 1, n}, {j, 1, n}, {k, 1, n}, {l, 1, n}]];
listlriemann := Table[
If[
UnsameQ[lriemann〚i, j, k, l〛, 0],
{Subscript[R, i, j, k, l], lriemann〚i, j, k, l〛}
19
listeinstein := Table[
If[
UnsameQ[einstein〚j, l〛, 0],
{Subscript[G, j, l], einstein〚j, l〛}
] , {j, 1, n}, {l, 1, j}];
Print["----------------------------------------------------------------------- "];
Print["Einstein Tensor:"];
Print[TableForm[
Partition[DeleteCases[Flatten[listeinstein], Null], 2], TableSpacing → {2, 2}]];
weyl := weyl = FullSimplifyTable
Ifn > 3,
lriemann〚i, j, k, l〛
1
- (metric〚i, k〛 ricci〚l, j〛 - metric〚i, l〛 ricci〚k, j〛 -
n-2
metric〚j, k〛 ricci〚l, i〛 + metric〚j, l〛 ricci〚k, i〛)
1
+ (metric〚i, k〛 metric〚l, j〛 - metric〚i, l〛 metric〚k, j〛) scalar
(n - 1) (n - 2)
(*else, if n≤ 3 return 0:*), 0,
listweyl := Table[
If[
UnsameQ[weyl〚i, j, k, l〛, 0],
{Subscript[ℭ, i, j, k, l], weyl〚i, j, k, l〛}
] , {i, 1, n}, {j, 1, i - 1}, {k, 1, n}, {l, 1, k - 1}];
Print["----------------------------------------------------------------------- "];
Print["Weyl Tensor:"];
Print[TableForm[
Partition[DeleteCases[Flatten[listweyl], Null], 2], TableSpacing → {2, 2}]];
geodesic := geodesic =
Simplify[Table[- Sum[affine〚i, j, k〛 u[j] u[k], {j, 1, n}, {k, 1, n}], {i, 1, n}]];
subst = Table[u[i] → Subscript[coord〚i〛, τ], {i, 1, n}];
nlistgeodesic :=
Table[{Subscript[coord〚i〛, ττ], "+", - geodesic〚i〛 /. subst, "= 0"}, {i, 1, n}];
Print["----------------------------------------------------------------------- "];
Print["Geodesic Equations:"];
Print[TableForm[nlistgeodesic, TableSpacing → {2}]];
-----------------------------------------------------------------------
-----------------------------------------------------------------------
21
1 0
gμν =
0 Sin[θ]2
1 0
gμν =
0 Csc[θ]2
-----------------------------------------------------------------------
Christoffel Symbols:
Γ 2
2,1 Cot[θ]
-----------------------------------------------------------------------
Riemann Tensor:
R12,2,1 - Sin[θ]2
R21,2,1 1
-----------------------------------------------------------------------
R2,1,2,1 Sin[θ]2
-----------------------------------------------------------------------
-----------------------------------------------------------------------
R2= 4
-----------------------------------------------------------------------
Ricci Tensor:
R1,1 1
R2,2 Sin[θ]2
-----------------------------------------------------------------------
Curvature Scalar:
R= 2
-----------------------------------------------------------------------
Einstein Tensor:
{}
-----------------------------------------------------------------------
Weyl Tensor:
{}
-----------------------------------------------------------------------
Geodesic Equations:
22
(*----------------------------------------------------------------------------*)
(* This is what you need to set: *)
coord = {t, r, θ, ϕ};
n = Length[coord];
metric =
2m
- 1 - ,0 ,0 , 0,
r
1
0 , ,0 , 0,
2m
1-
r
0 ,0 , r2 , 0,
0 ,0 ,0 , r Sin[θ] ;
2 2
(*----------------------------------------------------------------------------*)
inversemetric = FullSimplify[Inverse[metric]];
Print["----------------------------------------------------------------------- "];
Print["The Manifold has dimension n= ",
n, "\nCoordinate system: ", coord];
Print["----------------------------------------------------------------------- "];
Print["gμν =", metric // MatrixForm];
Print["gμν =", inversemetric // MatrixForm];
affine := affine = FullSimplifyTable
(1 / 2) * Sum
(* gis ∂kgsj+∂jgsk-∂sgjk *)
(inversemetric〚i, s〛) *
(D[metric〚s, j〛, coord〚k〛 ] +
D[metric〚s, k〛, coord〚j〛 ] - D[metric〚j, k〛, coord〚s〛 ]),
23
{s, 1, n},
{i, 1, n}, {j, 1, n}, {k, 1, n} ;
(*The non zero Christoffel symbols are computed and selected below: *)
listaffine := Table[
If[
UnsameQ[affine〚i, j, k〛, 0],
{Subscript[Superscript[Γ, i], j, k], affine〚i, j, k〛}
],
{i, 1, n}, {j, 1, n}, {k, 1, j}];
Print["----------------------------------------------------------------------- "];
Print["Christoffel Symbols:"];
Print[TableForm[
Partition[DeleteCases[Flatten[listaffine], Null], 2], TableSpacing → {2, 2}]];
riemann := riemann = FullSimplifyTable
(* Rijkl= ∂kΓilj - ∂lΓikj*)
D[ affine〚i, l, j〛, coord〚k〛 ] - D[affine〚i, k, j〛, coord〚l〛 ]+
(* Γiks Γslj - Γils Γskj *)
Sum[affine〚i, k, s〛 affine〚s, l, j〛 - affine〚i, l, s〛 affine〚s, k, j〛 ,
{s, 1, n}],
{i, 1, n}, {j, 1, n}, {k, 1, n}, {l, 1, n} ;
listriemann := Table[
If[
UnsameQ[riemann〚i, j, k, l〛, 0],
{Subscript[Superscript[R, i], j, k, l], riemann〚i, j, k, l〛}
],
{i, 1, n}, {j, 1, n}, {k, 1, n}, {l, 1, k - 1}];
Print["----------------------------------------------------------------------- "];
Print["Riemann Tensor:"];
Print[TableForm[
Partition[DeleteCases[Flatten[listriemann], Null], 2], TableSpacing → {2, 2}]];
lriemann := lriemann = FullSimplify[Table[
Sum[metric〚i, ii〛 riemann〚ii, j, k, l〛, {ii, 1, n}],
{i, 1, n}, {j, 1, n}, {k, 1, n}, {l, 1, n}]];
listlriemann := Table[
If[
UnsameQ[lriemann〚i, j, k, l〛, 0],
{Subscript[R, i, j, k, l], lriemann〚i, j, k, l〛}
] , {i, 1, n}, {j, 1, i - 1}, {k, 1, n}, {l, 1, k - 1}];
Print["----------------------------------------------------------------------- "];
Print["Contravariant Riemann Tensor:"];
Print[TableForm[
Partition[DeleteCases[Flatten[listlriemann], Null], 2], TableSpacing → {2, 2}]];
24
Print["----------------------------------------------------------------------- "];
Print["Einstein Tensor:"];
Print[TableForm[
Partition[DeleteCases[Flatten[listeinstein], Null], 2], TableSpacing → {2, 2}]];
weyl := weyl = FullSimplifyTable
Ifn > 3,
lriemann〚i, j, k, l〛
1
- (metric〚i, k〛 ricci〚l, j〛 - metric〚i, l〛 ricci〚k, j〛 -
n-2
metric〚j, k〛 ricci〚l, i〛 + metric〚j, l〛 ricci〚k, i〛)
1
+ (metric〚i, k〛 metric〚l, j〛 - metric〚i, l〛 metric〚k, j〛) scalar
(n - 1) (n - 2)
(*else, if n≤ 3 return 0:*), 0,
listweyl := Table[
If[
UnsameQ[weyl〚i, j, k, l〛, 0],
{Subscript[ℭ, i, j, k, l], weyl〚i, j, k, l〛}
] , {i, 1, n}, {j, 1, i - 1}, {k, 1, n}, {l, 1, k - 1}];
Print["----------------------------------------------------------------------- "];
Print["Weyl Tensor:"];
Print[TableForm[
Partition[DeleteCases[Flatten[listweyl], Null], 2], TableSpacing → {2, 2}]];
geodesic := geodesic =
Simplify[Table[- Sum[affine〚i, j, k〛 u[j] u[k], {j, 1, n}, {k, 1, n}], {i, 1, n}]];
subst = Table[u[i] → Subscript[coord〚i〛, τ], {i, 1, n}];
nlistgeodesic :=
Table[{Subscript[coord〚i〛, ττ], "+", - geodesic〚i〛 /. subst, "= 0"}, {i, 1, n}];
Print["----------------------------------------------------------------------- "];
Print["Geodesic Equations:"];
Print[TableForm[nlistgeodesic, TableSpacing → {2}]];
-----------------------------------------------------------------------
-----------------------------------------------------------------------
2m
-1 + 0 0 0
r
1
0 2m
0 0
gμν = 1-
r
0 0 r2 0
0 0 0 r2 Sin[θ]2
26
r
0 0 0
2 m-r
2m
0 1- 0 0
gμν =
r
1
0 0 0
r2
Csc[θ]2
0 0 0
r2
-----------------------------------------------------------------------
Christoffel Symbols:
Γ12,1
m
r (-2 m+r)
Γ21,1
m (-2 m+r)
r3
Γ 2 m
2,2
2 m r-r2
Γ 2
3,3 2m-r
Γ24,4 (2 m - r) Sin[θ]2
Γ33,2
1
r
Γ44,2
1
r
Γ44,3 Cot[θ]
-----------------------------------------------------------------------
Riemann Tensor:
2m
R12,2,1 -
r2 (-2 m+r)
m
R13,3,1
r
m Sin[θ]2
R14,4,1
r
2 m (2 m-r)
R21,2,1
r4
2 m
R 3,3,2 r
m Sin[θ]2
R24,4,2
r
m (-2 m+r)
R31,3,1
r4
m
R32,3,2
(2 m-r) r2
2 m Sin[θ]2
R34,4,3 -
r
m (-2 m+r)
R41,4,1
r4
m
R42,4,2
(2 m-r) r2
2m
R43,4,3
r
-----------------------------------------------------------------------
2m
R2,1,2,1 -
r3
m (-2 m+r)
R3,1,3,1
r2
m
R3,2,3,2
2 m-r
R4,3,4,3 2 m r Sin[θ]2
-----------------------------------------------------------------------
232 m (2 m-r)
R3
r6
141 m Csc[θ]2
R4 -
(2 m-r) r4
343 2 m Csc[θ]2
R4
r7
-----------------------------------------------------------------------
48 m2
R2=
r6
-----------------------------------------------------------------------
Ricci Tensor:
{}
-----------------------------------------------------------------------
Curvature Scalar:
R= 0
-----------------------------------------------------------------------
Einstein Tensor:
{}
-----------------------------------------------------------------------
Weyl Tensor:
28
ℭ2,1,2,1
2m
-
r3
ℭ3,1,3,1
m (-2 m+r)
r2
ℭ3,2,3,2
m
2 m-r
ℭ4,1,4,1
m (-2 m+r) Sin[θ]2
r2
ℭ4,2,4,2
m Sin[θ]2
2 m-r
ℭ4,3,4,3 2 m r Sin[θ]2
-----------------------------------------------------------------------
Geodesic Equations:
2 m rτ tτ
tττ + - = 0
2 m r-r2
2 2
+ (2 m - r) θτ2 + (2 m - r) Sin[θ]2 ϕτ2
m rτ m (2 m-r) tτ
rττ + - = 0
2 m r-r2 r3
2 rτ θτ
θττ + - Cos[θ] Sin[θ] ϕτ2 = 0
r
2 (rτ +r Cot[θ] θτ ) ϕτ
ϕττ + = 0
r
We can see the following symmetries of the Weyl tensor in this display: Cμν ρσ = -Cμν σρ = -Cνμ ρσ
2m m -2 m+r
0 0 0 0 0 - 0 0 0 0 0
r3 r2
0 0 0 0 2m
0 0 0 0 0 0 0
r3 m 2 m-r
0 0 0 0 0 0 0
0 0 0 0 r2
0 0 0 0
0 0 0 0 0 0 0 0
2m 0 0 0 0
0 0 0 0 0 0 0
r3 m
2m 0 0 0 0 0 0 0
- 0 0 0 2 m-r
r3 m
0 0 0 0 0 0 0
0 0 0 0 -2 m+r
0 0 0 0
0 0 0 0 0 0 0 0
m 2 m-r
0 0 0 0 0 0 0 0
r2 0 0 0 0
m
0 0 0 0 0 0 -2 m+r
0 0 0 0 0 0
m -2 m+r m 0 0 0 0 0
0 0 0 0 2 m-r
0 0
r2
0 0 0 0 0
0 0 0 0 0 0 0 0
m 2 m-r Sinθ2 0 0 0 0
0 0 0 0 0 0 0
r2 m Sinθ2
0 0 0 0 0 0 0 -2 m+r
0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 - 2 m r Sin[θ]2
m -2 m+r Sinθ 2
m Sinθ 2
0 0 2 m r Sin[θ]2 0
0 0 0 0 0 0
r2 2 m-r
Acknowledgment
The original program was kindly written by Leonard Parker, University of Wisconsin, Milwaukee
especially for this text.
29