Mathematica PDF
Mathematica PDF
This is a Mathematica program to compute the Christoffel and the geodesic equations, starting from a
given metric g . The Christoffel symbols are calculated from the formula
1
2
where g is the matrix inverse of g called the inverse metric. This is the solution of the relation (8.19)
and the notation for the inverse metric is standard [cf (20.17)]. The components of the geodesic equation are
du /d = -
u u .
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. The nonzero
components of the above quantities are displayed as the output.
r, , , t
r, , , t
You can change the names of the coordinates by simply editing the definition of coord, for example, to
coord = {x, y, z, t}, when another set of coordinate names is more appropriate.
christoffel.nb
metric
1, 0, 0, 0 , 0, r ^ 2
1, 0, 0, 0 , 0, b2
b ^ 2, 0, 0 , 0, 0, r ^ 2
r2 , 0, 0, 0, 0, b2
r2 Sin
b ^ 2 Sin ^ 2, 0 , 0, 0, 0,
, 0, 0, 0, 0,
MatrixForm
0
0 b2
0
r2
0
b
r Sin
2
0
1
Note:
It is important not to use the symbols, i, j, k, l, n, or s as constants or coordinates in the metric that you
specify above. The reason is that the first four of those symbols are used as summation or table
indices in the calculations done below. The last is the dimension of the space.
1, 0, 0, 0 , 0,
1
b2
r2
, 0, 0, 0, 0,
Csc
b2
, 0, 0, 0, 0,
r2
1
b2 r2
MatrixForm
0
0
Csc 2
b2 r2
Sum
inversemetric
D metric
j, k
i, s
, coord
, s, 1, n
christoffel.nb
The nonzero components of the affine connections are displayed below. You need not follow the details
of constructing the functions that we use for that purpose. Because the affine connection is symmetric
under interchange of the last two indices, only the independent components are displayed.
listaffine : Table If UnsameQ affine i, j, k , 0 ,
ToString
i, j, k , affine i, j, k
, i, 1, n , j, 1, n , k, 1, j
TableForm Partition DeleteCases Flatten listaffine , Null , 2 , TableSpacing
1, 2, 2
1, 3, 3
r Sin
2, 2, 1
2, 2
r
b2 r2
Cos Sin
2, 3, 3
3, 3, 1
r
b2 r2
3, 3, 2
Cot
u , where
u are the components of the four-velocity. (This gives the derivitive of u with respect to proper time
. (This is replaced by s if the geodesics are spacelike.)
geodesic : geodesic Simplify Table
k, 1, n , i, 1, n
Sum affine
i, j, k
u j u k , j, 1, n ,
r u 2
Sin
u 3
, i, 1, n
d d u 2
2ru 1 u 2
b2 r2
Cos Sin u 3
d d u 3
2ru 1 u 3
b2 r2
2 Cot u 2 u 3
d d u 4
Acknowledgment
This program was adapted from the notebook Curvature and the Einstein equation kindly written by
Leonard Parker especially for this text.