An Overview of General Relativity computations with DifferentialGeometry - Maple Programming Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Mathematics : DifferentialGeometry : DifferentialGeometry/OverviewOfGeneralRelativity

An Overview of General Relativity computations with DifferentialGeometry



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



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:


The following vector fields have been defined and protected:


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


frame name: M1


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));



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

Ein := EinsteinTensor(g);