Overview of General Relativity Computations - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : DifferentialGeometry : Overview of General Relativity Computations

An Overview of General Relativity computations with DifferentialGeometry

 

Description

1. Getting Started

2. Algebraic Manipulations of Tensors

3. Derivatives

4. Useful Utilities

5. Curvature Tensors

6. Working with Orthonormal Tetrads

7. Working with Null Tetrads and the Newman-Penrose Formalism

8. Two Component Spinor Formalism

9. Congruences

10. Electro-Vac Spacetimes

11. Exact Solution Database

12. Other Features

Description

• 

The GRTensor package, developed by K. Lake, P. Musgrave and D. Polleny, has long provided the general relativity community with an excellent collection of command for symbolic computations in general relativity. This functionality is also now available within the DifferentialGeometry package and its subpackage Tensor, as well as within the Physics package.

• 

This worksheet provides a quick introduction to General Relativity computations using DifferentialGeometry.

1. Getting Started

In this section we give a quick illustration of the use of the DifferentialGeometry software to perform a standard calculation in General Relativity. We shall solve the Einstein vacuum equations for spherically symmetric metrics in 4-dimensions. We check that the solution is of Petrov type D and we show that there are 4 Killing vectors.  First load the DifferentialGeometry package, the Tensor subpackage and the Tools subpackage.

with(DifferentialGeometry): with(Tensor): with(Tools):

All calculations in DifferentialGeometry begin by using the DGsetup command to initialize the computational environment. For our illustration we shall use standard spherical coordinates We use the name M1 to designate the computational environment (in this case a 4-dimensional manifold) which we are creating.

DGsetup([t, r, theta, phi], M1, verbose);

The following coordinates have been protected:

t,r,θ,φ

The following vector fields have been defined and protected:

D_t,D_r,D_θ,D_φ

The following differential 1-forms have been defined and protected:

dt,dr,dθ,dφ

frame name: M1

(1)

The coordinate vectors and the 1-forms are now defined and these can be used to construct general vector fields, differential forms and tensors. Use +/- for addition and subtraction, * for scalar multiplication, &t for tensor product and &w for wedge product. The command evalDG is used to insure that these operations are properly performed in DifferentialGeometry.

 

Here is the usual form for the static (time-independent), rotational invariant metric that is used as the starting ansatz for solving the Einstein equations. The two functions Ar and Br will be determined by the Einstein equations

g := evalDG( A(r) *dt &t dt + B(r)* dr &t dr + r^2*(dtheta &t dtheta + sin(theta)^2* dphi &t dphi));

gArdtdt+Brdrdr+r2dθdθ+r2sinθ2dφdφ

(2)

To solve the Einstein equations for this metric, we first calculate the Einstein tensor.

Ein := EinsteinTensor(g);

EinrⅆⅆrBr+Br2BrD_tArr2Br2D_tArBrⅆⅆrArrArD_rArBr2r2D_rⅆⅆrBrArⅆⅆrArr2Brⅆ2ⅆr2ArArr+BrⅆⅆrAr2r+2ⅆⅆrBrAr22ⅆⅆrArBrArD_θ4r3Br2Ar2D_θⅆⅆrBrArⅆⅆrArr2Brⅆ2ⅆr2ArArr+BrⅆⅆrAr2r+2ⅆⅆrBrAr22ⅆⅆrArBrArD_φ4r3Br2Ar2sinθ2D_φ

(3)

The command DGinfo is a utility program that can be used to obtain information about the computational environment and information about various DifferentialGeometry objects. Here we use DGinfoto extract all the coefficients of the Einstein tensor.  

EinEq := DGinfo(Ein, "CoefficientSet");

EinEqⅆⅆrBrArⅆⅆrArr2Brⅆ2ⅆr2ArArr+BrⅆⅆrAr2r+2ⅆⅆrBrAr22ⅆⅆrArBrAr4r3Br2Ar2,rⅆⅆrBr+Br2BrArr2Br2,ArBrⅆⅆrArrArArBr2r2,ⅆⅆrBrArⅆⅆrArr2Brⅆ2ⅆr2ArArr+BrⅆⅆrAr2r+2ⅆⅆrBrAr22ⅆⅆrArBrAr4r3Br2Ar2sinθ2

(4)

Now we use the Maple command pdsolve to integrate these differential equations:

Soln := pdsolve(EinEq);

SolnAr=r+c__1c__2r,Br=rr+c__1

(5)

The constant _C1 is essentially the mass of the point source of the gravitational field. The constant _C2 is easily normalized to -1 by a re-scaling of time.

gS := subs({_C1 = - 2*m, _C2= -1},subs(Soln, g));

gSr2mdtrdt+rdrr2mdr+r2dθdθ+r2sinθ2dφdφ

(6)

This is the Schwarzschild metric in standard coordinates. The Einstein tensor vanishes as required.

EinsteinTensor(gS);

0D_tD_t

(7)

 

The metric admits 4 Killing vectors.  

K := KillingVectors(gS);

KD_t,sinφD_θ+cosφcotθD_φ,cosφD_θsinφcotθD_φ,D_φ

(8)

subs({sqrt(1-cos(2*theta)) = sqrt(2)*sin(theta)}, K);

D_t,sinφD_θ+cosφcotθD_φ,cosφD_θsinφcotθD_φ,D_φ

(9)

The Petrov type of this metric is "D".

PetrovType(gS);

D

(10)

It is often convenient to store the entries of a metric in a symmetric matrix.

convert(convert(gS, DGArray), Matrix);

r2mr0000rr2m0000r20000r2sinθ2

(11)

 

2. Algebraic Manipulations of Tensors

We use a simple metric defined on a 3-dimensional space to illustrate some basis algebraic manipulations with tensors.

 

First define a coordinate chart with coordinates

DGsetup([x, y, z], M2);

frame name: M2

(12)

Define a metric g.

g2 := evalDG(z*(dx&t dy + dy &t dx) + x^2*dz &t dz);

g2zdxdy+zdydx+x2dzdz

(13)

Calculate the inverse metric  

h := InverseMetric(g2);

hD_xzD_y+D_yzD_x+D_zx2D_z

(14)

Define a rank 3 tensor.

T := evalDG(dx &t D_y &t dz);

TdxD_ydz

(15)

Lower the second index of T.

RaiseLowerIndices(g2, T, [2]);

zdxdxdz

(16)

Raise the 1st and 3rd indices of T using the inverse metric h.  

RaiseLowerIndices(h, T, [1,3]);

D_yzx2D_yD_z

(17)

Rearrange the 1st and 2nd indices.

RearrangeIndices(T, [[1,2]]);

D_ydxdz

(18)

Symmetrize over the 1st and 3rd indices

SymmetrizeIndices(T, [1, 3], "Symmetric");

dx2D_ydz+dz2D_ydx

(19)

3. Derivatives

One can compute the exterior derivative of a differential form, the Lie derivative of any tensor field with respect to a vector field or the covariant derivative of any tensor field with respect to a connection 

DGsetup([x, y, z], N);

frame name: N

(20)

Define a 1-form and calculate the exterior derivative.

omega := evalDG(sin(x) *dy + x^2*dz);

ωsinxdy+x2dz

(21)

ExteriorDerivative(omega);

cosxdxdy+2xdxdz

(22)

Define a vector field X  and a tensor T   and calculate the Lie derivative.

X := evalDG(y*D_x + x*D_z);

XyD_x+xD_z

(23)

T := evalDG(x^2*D_y &t dz);

Tx2D_ydz

(24)

LieDerivative(X, T);

x2D_xdz+x2D_ydx+2yxD_ydz

(25)

Define a connection and calculate the covariant derivative of T.  

C := Connection(a*D_z &t dx &t dy);

CaD_zdxdy

(26)

CovariantDerivative(T, C);

ax2D_ydxdy+2xD_ydzdx

(27)

4. Useful Utilities

The DifferentialGeometry package has many useful utilities for working with differential forms and tensors.  For example, we can easily construct a general metric as follows. (GenerateSymmetricTensors, DGzip)

DGsetup([x, y, z], N);

frame name: N

(28)

S := GenerateSymmetricTensors([dx, dy , dz], 2);

Sdxdx,dx2dy+dy2dx,dx2dz+dz2dx,dydy,dy2dz+dz2dy,dzdz

(29)

g := DGzip([a1,a2,a3,a4,a5,a6](x, y, z), S, "plus");

ga1x,y,zdxdx+a2x,y,zdx2dy+a3x,y,zdx2dz+a2x,y,zdy2dx+a4x,y,zdydy+a5x,y,zdy2dz+a3x,y,zdz2dx+a5x,y,zdz2dy+a6x,y,zdzdz

(30)

As another example, we can get the components of any tensor with respect to any basis with the command GetComponents.

B := evalDG([dx , dx -dy, dx +2*dy -dz]);

Bdx,dxdy,dx+2dydz

(31)

alpha := evalDG(dx - 3*dy + 5*dz);

αdx3dy+5dz

(32)

GetComponents(alpha, B);

13,−7,−5

(33)

 

5. Curvature Tensors

The Riemann curvature tensor, the Ricci tensor, the Ricci scalar and the Weyl tensor of a metric are easily computed. Here we use the Godel metric.

DGsetup([x, y, z, t], M5);

frame name: M5

(34)

To define the metric, we first define a 1-form and then define the metric in terms of the 1-form.

omega := evalDG(dt + exp(x)*dz);

ωⅇxdz+dt

(35)

g5 := evalDG(dx &t dx + dy &t dy +1/2*exp(2*x)*dz &t dz - omega &t omega);

g5dxdx+dydyⅇ2xdz2dzⅇxdzdtⅇxdtdzdtdt

(36)

Here is the curvature tensor (as a type (1, 3)) tensor.

CurvatureTensor(g5);

3ⅇ2xD_x4dzdxdz+ⅇxD_x2dzdxdt3ⅇ2xD_x4dzdzdxⅇxD_x2dzdtdx+ⅇxD_x2dtdxdz+D_x2dtdxdtⅇxD_x2dtdzdxD_x2dtdtdxD_z2dxdxdz+D_z2dxdzdx+ⅇxD_z2dzdzdtⅇxD_z2dzdtdz+D_z2dtdzdtD_z2dtdtdz+ⅇxD_tdxdxdz+D_t2dxdxdtⅇxD_tdxdzdxD_t2dxdtdxⅇ2xD_t4dzdzdt+ⅇ2xD_t4dzdtdzⅇxD_t2dtdzdt+ⅇxD_t2dtdtdz

(37)

Here is the Ricci tensor.

RicciTensor(g5);

ⅇ2xdzdz+ⅇxdzdt+ⅇxdtdz+dtdt

(38)

Here is the Ricci scalar.

RicciScalar(g5);

−1

(39)

 

6. Working with Orthonormal Tetrads

Many calculations in General Relativity can be dramatically simplified by defining an orthonormal tetrad and by expressing the metric and all other tensors in terms of this orthonormal tetrad. This is particularly true when a co-frame can be chosen with simple structure equations.

A simple illustration of this is provided by the Godel metric from the previous example.

DGsetup([x, y, z, t], M6);

frame name: M6

(40)

omega := evalDG(dt + exp(x)*dz);

ωⅇxdz+dt

(41)

g6 := evalDG(dx &t dx + dy &t dy +1/2*exp(2*x)*dz &t dz - omega &t omega);

g6dxdx+dydyⅇ2xdz2dzⅇxdzdtⅇxdtdzdtdt

(42)

Omega := evalDG([dx, dy, 1/sqrt(2)*exp(x)*dz, omega]);

Ωdx,dy,2ⅇxdz2,ⅇxdz+dt

(43)

We use TensorInnerProduct to check that the forms in the list define an orthonormal tetrad.

TensorInnerProduct(g6, Omega, Omega);

100001000010000−1

(44)

The command FrameData calculates the structure equations for this frame and stores the results in a format that can be used by DGsetup.

FD := FrameData(Omega, O6);

FDdΘ1=0,dΘ2=0,dΘ3=Θ1Θ3,dΘ4=2Θ1Θ3

(45)

What is nice about this co-frame is that the structure functions are all constant -- even though there was an exponential function in the metric.   We run DGsetup again to create a new computational environment which used this co-frame and these structure equations.

DGsetup(FD, [E], [theta]);

frame name: O6

(46)

newg6 := evalDG(theta1 &t theta1 + theta2 &t theta2 + theta3 &t theta3 - theta4 &t theta4);

newg6θ1θ1+θ2θ2+θ3θ3θ4θ4

(47)

The curvature tensor and the Ricci tensor take simple forms in terms of this frame.

CurvatureTensor(newg6);

E12θ3θ1θ3E12θ3θ3θ1+E12θ4θ1θ4E12θ4θ4θ1E32θ1θ1θ3+E32θ1θ3θ1+E32θ4θ3θ4E32θ4θ4θ3+E42θ1θ1θ4E42θ1θ4θ1+E42θ3θ3θ4E42θ3θ4θ3

(48)

RicciTensor(newg6);

θ4θ4

(49)

 

7. Working with Null Tetrads and the Newman-Penrose Formalism

The DifferentialGeometry package supported computations in all the different formalisms for general relativity -- coordinate calculations, orthonormal tetrads, null tetrads and the Newman-Penrose formalism, and the two-component spinor formalism. The tools are readily available for moving from one formalism to another.   

 

In this example we calculate the Newman-Penrose curvature scalars for a metric.

DGsetup([r, u, x, y], M7);

frame name: M7

(50)

g7 := evalDG(dr &t du + du &t dr -((2*(3*x*r+m))*du &t du)/r-(1/4)*(r^2*dx &t dx)/x^3-(1/4)*(r^2*dy &t dy)/x^3);

g7drdu+dudr23xr+mdurdur2dx4x3dxr2dy4x3dy

(51)

The command DGGramSchmidt and NullTetrad provide useful tools for constructing null tetrads. Here is the one that we shall use for this example

NT := evalDG([D_r, (3*x*r+m)*D_r/r+D_u, I*sqrt(2)*x^(3/2)*D_x/r+sqrt(2)*x^(3/2)*D_y/r, -I*sqrt(2)*x^(3/2)*D_x/r+sqrt(2)*x^(3/2)*D_y/r]);

NTD_r,3xr+mD_rr+D_u,I2x32D_xr+2x32D_yr,I2x32D_xr+2x32D_yr

(52)

Here are the Newman-Penrose curvature scalars for this null tetrad.

NP := NPCurvatureScalars(NT, output = ["WeylScalars"]);

NPtablePsi3=3I2x32r2,Psi1=0,Psi0=0,Psi4=18x2r2,Psi2=mr3

(53)

8. Two Component Spinor Formalism

As a quick illustration of the 2-component spinor formalism, we calculate the Weyl spinor for the metric from the previous paragraph. To work with spinors we use DGsetup to specify both the coordinates for the space-time and also the coordinates to be used for the spinors and their complex conjugates.  

DGsetup([r, u, x, y], [z1, z2, w1, w2], M8);

frame name: M8

(54)

Here is metric as before.  

g8 := evalDG(dr &t du + du &t dr -((2*(3*x*r+m))*du &t du)/r-(1/4)*(r^2*dx &t dx)/x^3-(1/4)*(r^2*dy &t dy)/x^3);

g8drdu+dudr23rx+mdurdur2dx4x3dxr2dy4x3dy

(55)

Here is the null tetrad as before.

NT := evalDG([D_r, (3*x*r+m)*D_r/r+D_u, I*sqrt(2)*x^(3/2)*D_x/r+sqrt(2)*x^(3/2)*D_y/r, -I*sqrt(2)*x^(3/2)*D_x/r+sqrt(2)*x^(3/2)*D_y/r]);

NTD_r,3rx+mD_rr+D_u,I2x32D_xr+2x32D_yr,I2x32D_xr+2x32D_yr

(56)

We use the null tetrad to construction an orthonormal tetrad.

OT := OrthonormalTetrad(NT);

OT23rx+m+rD_r2r+2D_u2,2x32D_yr,2x32D_xr,23rx+mrD_r2r2D_u2

(57)

We use the orthonormal tetrad to define the solder form as a spin-tensor σa   AX'.

sigma := SolderForm(OT);

σdrD_z1D_w13rx+mdurD_z1D_w1+duD_z2D_w2I4r2dxx32D_z1D_w2+I4r2dxx32D_z2D_w1+r2dy4x32D_z1D_w2+r2dy4x32D_z2D_w1

(58)

Here is the null vector as a 2-component spinor.

convert(D_r, DGspinor, sigma, [1]);

D_z1D_w1

(59)

We use SpinorInnerProduct to check that the contracted product re-produces the metric.

SpinorInnerProduct(sigma, sigma);

drdu+dudr23rx+mdurdur2dx4x3dxr2dy4x3dy

(60)

Here is the Weyl spinor.  

WeylSpinor(sigma);

mdz1r3dz1dz2dz2+mdz1r3dz2dz1dz2+mdz1r3dz2dz2dz1+3I2x32dz1r2dz2dz2dz2+mdz2r3dz1dz1dz2+mdz2r3dz1dz2dz1+3I2x32dz2r2dz1dz2dz2+mdz2r3dz2dz1dz1+3I2x32dz2r2dz2dz1dz2+3I2x32dz2r2dz2dz2dz118x2dz2r2dz2dz2dz2

(61)

 

9. Congruences

Line congruences (especially null congruences) play an important role in the geometric analysis of space-times. We continue with the metric from the previous example. We show that the congruence defined by D_ris defines a shear-free principal null direction.

U := D_r;

UD_r

(62)

V := evalDG((3*x*r+m)*D_r/r+D_u);

V3rx+mD_rr+D_u

(63)

W := WeylTensor(g8):

GRQuery(U, g8, W, "PrincipalNullDirection");

true

(64)

Here are the properties of the null congruence defined by U.

CongruenceProperties(g8, U, V);

tableRotationScalar=0,RotationNormSquared=0,Raychaudhuri=0,RotationTensor=0drdr,ShearNormSquared=0,Expansion=2r,ShearTensor=0drdr

(65)

10. Electro-Vac Spacetimes

A space-time is called an electro-vac space-time if there exists an electromagnetic field which solves the Einstein-Maxwell field equations. The problem of deciding if a space-time is electro-vac can be solved using the command RainichConditions and RainichElectromagneticField. Here is a simple example.

DGsetup([t, x, y, z], M10);

frame name: M10

(66)

g10 := evalDG(4/3*t^2* dx &t dx + t*(exp(-2*x)* dy &t dy + exp(2*x)*dz &t dz) - dt &t dt);

g10dtdt+4t2dx3dx+tⅇ2xdydy+tⅇ2xdzdz

(67)

Test to see if the Rainich conditions for a spacetime hold.

RainichConditions(g10);

true

(68)

We conclude the space-time is an electro-vac spacetime. Here is the electro-magnetic field.

F := RainichElectromagneticField(g10);

F2cosc__11+csgn1t2dt6csgn1t2+6dx+sinc__11+csgn1t2csgn1t2dy2csgn1t2+2dz

(69)

F := simplify(F) assuming t > 0;

F2cosc__13dt3dx+sinc__1dydz

(70)

We check that the Einstein equations are satisfied (See EinsteinTensor, EnergyMomentumTensor).

T := EnergyMomentumTensor("Electromagnetic", g10, F); E := EinsteinTensor(g10); E &minus T;

TD_t2t2D_t3D_x8t4D_x+ⅇ2xD_y2t3D_y+ⅇ2xD_z2t3D_z

ED_t2t2D_t3D_x8t4D_x+ⅇ2xD_y2t3D_y+ⅇ2xD_z2t3D_z

0D_tD_t

(71)

We check that the Maxwell equations (see MatterFieldEquations) are satisfied.

MatterFieldEquations("Electromagnetic", g10, F);

0D_t,0dtdxdy

(72)

 

11. Exact Solution Database

An database of exact solutions of the Einstein equations can be accessed using either the Browse and or the MetricSearch commands from the DifferentialGeometry Library subpackage.  

 

12. Other Features

• 

Transformation between space-times can be constructed. See Transformation, Pullback, Pushforward 

• 

The Segre classification of space-time can be calculated.

• 

The KillingVector and PetrovType commands support case-splitting for metrics which depend upon arbitrary parameters or functions.

• 

Killing tensors, Killing-Yano tensors, Killing spinors and recurrent tensors can all be calculated.  

• 

The LieAlgebras package provides all the tools needed for a complete algebraic analysis of the Killing vectors of a space-time.

• 

The isotropy subalgebra and isotropy type of a Lie algebra of Killing vectors can be determined. These are useful properties for classifying Killing vectors.

• 

Invariant metrics for any Lie algebra of vector fields can be easily computed using the command InvariantGeometricObjectFields in the GroupActions package.

• 

Residual diffeomorphism groups for reductions of space-times can be calculated with the command InfinitisimalPseudoGroupNormalizer 

• 

Future releases of DifferentialGeometry will include commands for working with the Einstein-Yang-Mills equations and for abstractly solving the Einstein equations on homogeneous spaces and low cohomogeneity manifolds.  

See Also

Physics

Physics[Christoffel]

Physics[D_]

Physics[Einstein]

Physics[Ricci]

Physics[Riemann]

Physics[Weyl]