Application Center - Maplesoft

# Gravitation

You can switch back to the summary page by clicking here.

Documentation for the Gravitation Package

John Fredsted

 > restart:

 > with(Gravitation);

Generals

All objects (tensors and pseudo-tensors) have the following attributes:

Class The class of the object
Rank The rank of the object

Type The type of the object
Comps The components of the object

Class::string

The Class string can take on three values; "METRIC", "TETRAD", "OBJECT", corresponding to the
three available constructors of the package; createMetric(), createTetrad(), createObject().

Rank::posint

The rank number equals the length of the type string, or (equivalently) the number of dimensions of the components.

Type::string

The type string consists of the letters L, R, l, and r:

- An "L" denotes a lowered coordinate (world) index, i.e., a covariant holonomic index
- An "R" denotes a raised coordinate (world) index, i.e., a contravariant holonomic index
- An "l" denotes a lowered tangent space index, i.e., a covariant anholonomic index
- An "r" denotes a raised tangent space index, i.e., a contravariant anholonomic index

Comps::Array

For any object, the components are contained in an Array (capital A).

Constructors

There are available three different constructors:

1. The metric constructor, used for creating a metric object (or the inverse metric object)

2. The tetrad constructor, used for creating a tetrad object (or the inverse tetrad object)

3. The object constructor, used for creating an object, which is neither a metric nor a tetrad

Below, an example of each is given. Note that the methods (given by the export-lists) for the three constructors differ

The metric constructor

The constructor takes three arguments:

1. The type which may be either "LL" or "RR", the latter corresponding to the inverse metric

2. The components, contained in a two-dimensional Array (capital A)

3. The coordinates, contained in a list

 > # Example: The Schwarzschild metric metricComps := Array([ [-(1-2*M/(1*r)),0,0,0], [0,1/(1-2*M/r),0], [0,0,r^2,0], [0,0,0,r^2*sin(theta)^2] ]): metric := createMetric("LL",metricComps,[t,r,theta,phi]);

 > metric:-getClass(),metric:-getRank(),metric:-getType(),metric:-getComps();

The constructor takes four arguments:

1. The type which may be either "rL" or "Rl", the latter corresponding to the inverse tetrad

2. The components, contained in a two-dimensional Array (capital A)

3. The signature of the tangent space, contained in a list

4. The coordinates, contained in a list

 > # Example: The Schwarzschild tetrad tetradComps := Array([ [sqrt(1-2*M/r),0,0,0], [0,1/sqrt(1-2*M/r),0,0], [0,0,r,0], [0,0,0,r*sin(theta)] ]): tetrad := createTetrad("rL",tetradComps,[-1,1,1,1],[t,r,theta,phi]);

The object constructor

The constructor takes three arguments:

1. The type of the object

2. The components of the object, contained in an Array (capital A)

3. Either a metric or a tetrad, the role of which is twofold:

i. To fix the way indices are to be lowered and raised

ii. Provide the coordinates on which the components depend

Note that when a tetrad is provided, the metric (necessary for lowering and raising coordinate indices), if needed, is derived from that tetrad

 > # Example: The Faraday tensor, of electromagnetism faradayComps := Array([ [0,-Ex,-Ey,-Ez], [+Ex,0,+Bz,-By], [+Ey,-Bz,0,+Bx], [+Ez,+By,-Bx,0] ]): faraday := createObject("LL",faradayComps,metric);

Connections

There are available the following methods for deriving connections:
- deriveChristoffel() The metric-compatible Levi-Civita connection

- deriveSpinConnection() The minimal (torsionless) spin connection

Note that non-metric compatible Levi-Civita connections and non-minimal spin connections may (only) be defined manually through the createObject() constructor

The Christoffel connection

 > christoffel := deriveChristoffel(metric): christoffel:-getClass(),christoffel:-getRank(),christoffel:-getType(),christoffel:-getComps();

 > christoffel:-flattenNonZeroComps();

The minimal spin connection

 > spinConnection := deriveSpinConnection(tetrad): spinConnection:-getClass(),spinConnection:-getRank(),spinConnection:-getType(),spinConnection:-getComps();

 > spinConnection:-flattenNonZeroComps();

Curvature tensors

There are available the following methods for deriving curvature tensors:

- deriveRiemann() The rank four Riemann tensor

- deriveRicci() The rank two Ricci tensor

- deriveRicciScalar() The rank zero Ricci scalar

- deriveEinstein() The rank two Einstein tensor

- deriveWeyl() The rank four Weyl tensor

- deriveKretschmann() The rank zero Kretschmann scalar, the 'sum-square' of the Riemann tensor

- deriveSpinCurvature() The rank four curvature tensor corresponding to the spin connection

The Riemann tensor

 > riemann := deriveRiemann(christoffel): riemann:-getClass(),riemann:-getRank(),riemann:-getType(),riemann:-getComps();

 > riemann:-flattenNonZeroComps();

The Ricci tensor

 > ricci := deriveRicci(christoffel): ricci:-getClass(),ricci:-getRank(),ricci:-getType(),ricci:-getComps();

The Ricci scalar

 > ricciScalar := deriveRicciScalar(christoffel): ricciScalar:-getClass(),ricciScalar:-getRank(),ricciScalar:-getType(),ricciScalar:-getComps();

The Einstein tensor

 > einstein := deriveEinstein(christoffel): einstein:-getClass(),einstein:-getRank(),einstein:-getType(),einstein:-getComps();

The Weyl tensor

 > weyl := deriveWeyl(christoffel): weyl:-getClass(),weyl:-getRank(),weyl:-getType(),weyl:-getComps();

 > weyl:-flattenNonZeroComps();

The Kretschmann scalar

 > kretschmann := deriveKretschmann(christoffel): kretschmann:-getClass(),kretschmann:-getRank(),kretschmann:-getType(),kretschmann:-getComps();

The spin curvature tensor

 > spinCurvature := deriveSpinCurvature(spinConnection): spinCurvature:-getClass(),spinCurvature:-getRank(),spinCurvature:-getType(),spinCurvature:-getComps();

 > spinCurvature:-flattenNonZeroComps();

Object methods

The three objects classes ("METRIC", "TETRAD", "OBJECT") have methods as given by the lists below, following the word 'export'

Common methods for all object classes are

- getClass() Returns the class (has already been used above)
- getRank() Returns the rank (has already been used above)
- getType() Returns the type (has already been used above)
- getComps() Returns the components as an Array (has already been used above)
- lowerIndex() Lowers an index, and changes the type accordingly
- raiseIndex() Raises an index, and changes the type accordingly

- multiplyScalar() Multiplies all components by some scalar (in the matrix sense)

- diffPartial() Takes the partial derivatives with respect to the coordinates

- diffDivergence() Takes the covariant divergence
- flattenComps() Puts the components in a list with entries of the form [indices] = value
- flattenNonZeroComps() Puts the nonzero components in a list with entries of the form [indices] = value (has already been used above)
- isZero() Checks whether the components are all zero

IMPORTANT: When indices of a metric or tetrad (or their inverses) are lowered or raised, the class changes to "OBJECT". For the metric, the reason for this is obvious; raising an index of the metric produces the Kronecker delta, which, of course, can no longer be classified as "METRIC"

IMPORTANT: The differentiating index for diffPartial(), diffGradient(), and diffDivergence() is the LAST one, i.e., the comma and semicolon notation

is used for the partial derivatives and the covariant derivatives, respectively

Below follows some examples:

 > # Lower the first index and raise the second index of the tetrad tetrad:-lowerIndex(1):-raiseIndex(2):-getType(), tetrad:-lowerIndex(1):-raiseIndex(2):-getComps();

 > # Find all nonzero partial derivatives of the components of the metric # Note that the differentiating index is the LAST one metric:-diffPartial():-flattenNonZeroComps();

 > # Find all nonzero covariant derivatives of the metric (there should be none, using the Christoffel connection) metric:-diffGradient(christoffel):-flattenNonZeroComps(), metric:-diffGradient(christoffel):-isZero();

 > # Find all nonzero covariant derivatives of the tetrad (there should be none, using simultaneously # the Christoffel connection and the spin connection) tetrad:-diffGradient(christoffel,spinConnection):-flattenNonZeroComps(), tetrad:-diffGradient(christoffel,spinConnection):-isZero();

 > # Find the covariant divergences of the Einstein tensor (should all be zero, using the Christoffel connection) # The integer denotes the index to contract upon einstein:-diffDivergence(1,christoffel):-getComps(), einstein:-diffDivergence(2,christoffel):-getComps();

Common methods for object classes "METRIC" or "TETRAD"

- getCoords() Gets the (world) coordinates

- getDim() Gets the dimension of the manifold (the number of coordinates)

- getInverse() Finds the inverse metric/tetrad (or the inverse of the inverse metric/tetrad)

Common methods for object classes "METRIC" and "OBJECT"

- contractIndices() Contracts a pair of indices, either a holonomic pair, or an anholomomic pair

(contraction is not possible on the tetrad, because it is mixed-holonomic)

Below follows an example:

 > # Find the trace of the Weyl tensor (must vanish identically) # Note that some index (here the first one) needs to be lifted prior to contraction weyl:-raiseIndex(1):-contractIndices(1,3):-getComps();

Specific methods for object class "TETRAD"

- getSignature() Gets the signature of the tetrad (the signature of the tangent space)

- getFlatMetricComps() Gets the components of the flat metric (the metric of the tangent space)

- getWorldMetricComps() Gets the components of the world metric corresponding to the tetrad

Specific methods for object class "OBJECT"

- getMetric() Gets the metric (may be undefined) associated with the object
- getTetrad() Gets the tetrad (may be undefined) associated with the object

- setType() Sets the type of the object, using the lowerIndex() and raiseIndex() methods

- transposeIndices() Transposes a pair of indices

- permuteIndices() Permutes the indices

Below follows some examples:

 > # Two equivalent ways of lowering the first index and raising the second index of the Christoffel connection christoffel:-lowerIndex(1):-raiseIndex(2):-getType(), christoffel:-setType("LRL"):-getType();

 > # Find the derivatives of the metric with respect to either r or theta, # by making the differentiating index the first one using permuteIndices() metric:-diffPartial():-permuteIndices([3,1,2]):-getComps()[2], metric:-diffPartial():-permuteIndices([3,1,2]):-getComps()[3];

Binary object methods

All methods used hitherto have been methods associated with one single object.

Methods taking two objects are the following:

- addObjects() Adds the components of two objects (if the types are compatible)
- subtractObjects() Subtracts the components of two objects (if the types are compatible)

- multiplyObjects() Tensor-multiplies the components of two objects (adding ranks, and concatinating types)

- areEqual() Checks whether the components of two objects are equal (a minimum requirement, of course, is equality of their types)

Below follows an example:

 > # Testing for inverse metric multiplyObjects(metric,metric:-getInverse()):-contractIndices(2,3):-getComps(), multiplyObjects(metric:-getInverse(),metric):-contractIndices(2,3):-getComps();

Legal Notice: The copyright for this application is owned by the author(s). Neither Maplesoft nor the author are responsible for any errors contained within and are not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact the author for permission if you wish to use this application in for-profit activities.