Package examples

<<"~/Desktop/EinsteinVariation.m"

All of the function in this package take a metric (a square matrix) and the coordinate labels (a vector) as inputs.

Spherical Coordinates

For Minkowski space-time, in spherical coordinates:

gll = DiagonalMatrix[{-1,1,r^2,r^2 Sin[T]^2}];
guu = Inverse[gll];
Xu = {t,r,T,P};

MatrixForm[gll]

This gives the Christoffel coefficients of the second kind (up-down-down form):

CCull = GetCCull[gll,Xu]

We can access the components of this tripley-indexed object in the usual way (Mathematica indices start from 1):

CCull[[2,3,3]]

Here is the Riemann tensor (up-down-down-down form) for Minkowski space-time written in spherical coordinates.  It is zero, since the spacetime is flat.

GetRiemann[gll,Xu]

Sphere

On the surface of a sphere :

gll = {{r^2,0},{0,r^2 Sin[T]^2}};
guu = Inverse[gll];
Xu = {T,P};

MatrixForm[gll]

Rulll = GetRiemann[gll,Xu]

For a sphere, the Riemann tensor is not zero, we can access components via:

Rulll[[1,2,1,2]]

We can drop an index using the metric to get the fully covariant form of the Riemann tensor:

Rllll = Table[Sum[Rulll[[s1,b,u,v]] gll[[s1,a]] ,{s1,1,2}],{a,1,2},{b,1,2},{u,1,2},{v,1,2}]

We can get the Ricci tensor from the package (or you could trace out the Riemann tensor)

GetRicci[gll,Xu]

And here is the Ricci scalar:

GetRicciS[gll,Xu]

The connection, in its one-up, two-down form (Christoffel symbol of the second kind):

CCull = GetCCull[gll,Xu]

CCull[[1,2,2]]

CCull[[2,1,2]]

CCull[[2,2,1]]