Application Center - Maplesoft

App Preview:

Gravitation

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

Learn about Maple
Download Application


 

Image 

Documentation for the Gravitation Package 

John Fredsted  

> restart:
 

> with(Gravitation);
 

[aboutGravitation, addObjects, areEqual, createMetric, createObject, createTetrad, deriveChristoffel, deriveEinstein, deriveKretschmann, deriveRicci, deriveRicciScalar, deriveRiemann, deriveSpinConnec...
[aboutGravitation, addObjects, areEqual, createMetric, createObject, createTetrad, deriveChristoffel, deriveEinstein, deriveKretschmann, deriveRicci, deriveRicciScalar, deriveRiemann, deriveSpinConnec...
[aboutGravitation, addObjects, areEqual, createMetric, createObject, createTetrad, deriveChristoffel, deriveEinstein, deriveKretschmann, deriveRicci, deriveRicciScalar, deriveRiemann, deriveSpinConnec...
 

About 

> aboutGravitation();
 

`------------------------------------------------------------------------------------`
 

`An object-oriented package for gravitational tensor calculation`
 

`------------------------------------------------------------------------------------`
 

`The package treats all the following three cases`
 

`1. The metric case`
 

`2. The tetrad case`
 

`3. The mixed case`
 

`The package is able to treat as independent variables the`
 

`metric, Levi-Civita connection, tetrad, and spin connection`
 

`------------------------------------------------------------------------------------`
 

`Copyright 2007, by John Fredsted`
 

`For contact information, please see http://www.johnfredsted.dk/`
 

`------------------------------------------------------------------------------------`
 

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 := module () local CLASS, RANK, TYPE, COMPS, COORDS, DIM; export getClass, getRank, getType, getComps, getCoords, getDim, getInverse, lowerIndex, raiseIndex, contractIndices, multiplyScalar, di...
metric := module () local CLASS, RANK, TYPE, COMPS, COORDS, DIM; export getClass, getRank, getType, getComps, getCoords, getDim, getInverse, lowerIndex, raiseIndex, contractIndices, multiplyScalar, di...
metric := module () local CLASS, RANK, TYPE, COMPS, COORDS, DIM; export getClass, getRank, getType, getComps, getCoords, getDim, getInverse, lowerIndex, raiseIndex, contractIndices, multiplyScalar, di...
 

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

Typesetting:-mrow(Typesetting:-ms(
 

The tetrad constructor 

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

tetrad := module () local a, b, mu, nu, CLASS, RANK, TYPE, COMPS, COORDS, DIM, SIGNATURE, FLAT_METRIC_COMPS, WORLD_METRIC_COMPS; export getClass, getRank, getType, getComps, getCoords, getDim, getSign...
tetrad := module () local a, b, mu, nu, CLASS, RANK, TYPE, COMPS, COORDS, DIM, SIGNATURE, FLAT_METRIC_COMPS, WORLD_METRIC_COMPS; export getClass, getRank, getType, getComps, getCoords, getDim, getSign...
tetrad := module () local a, b, mu, nu, CLASS, RANK, TYPE, COMPS, COORDS, DIM, SIGNATURE, FLAT_METRIC_COMPS, WORLD_METRIC_COMPS; export getClass, getRank, getType, getComps, getCoords, getDim, getSign...
tetrad := module () local a, b, mu, nu, CLASS, RANK, TYPE, COMPS, COORDS, DIM, SIGNATURE, FLAT_METRIC_COMPS, WORLD_METRIC_COMPS; export getClass, getRank, getType, getComps, getCoords, getDim, getSign...
 

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

Typesetting:-mrow(Typesetting:-ms(
 

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

faraday := module () local CLASS, RANK, TYPE, COMPS, METRIC, TETRAD; export getClass, getRank, getType, getComps, getMetric, getTetrad, lowerIndex, raiseIndex, setType, transposeIndices, permuteIndice...
faraday := module () local CLASS, RANK, TYPE, COMPS, METRIC, TETRAD; export getClass, getRank, getType, getComps, getMetric, getTetrad, lowerIndex, raiseIndex, setType, transposeIndices, permuteIndice...
faraday := module () local CLASS, RANK, TYPE, COMPS, METRIC, TETRAD; export getClass, getRank, getType, getComps, getMetric, getTetrad, lowerIndex, raiseIndex, setType, transposeIndices, permuteIndice...
faraday := module () local CLASS, RANK, TYPE, COMPS, METRIC, TETRAD; export getClass, getRank, getType, getComps, getMetric, getTetrad, lowerIndex, raiseIndex, setType, transposeIndices, permuteIndice...
 

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

Typesetting:-mrow(Typesetting:-ms(
 

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

Typesetting:-mrow(Typesetting:-ms(
 

> christoffel:-flattenNonZeroComps();
 

[([1, 1, 2]) = -M/(r*(-r+2*M)), ([1, 2, 1]) = -M/(r*(-r+2*M)), ([2, 1, 1]) = -(-r+2*M)*M/r^3, ([2, 2, 2]) = M/(r*(-r+2*M)), ([2, 3, 3]) = -r+2*M, ([2, 4, 4]) = (-r+2*M)*sin(theta)^2, ([3, 2, 3]) = 1/r...
[([1, 1, 2]) = -M/(r*(-r+2*M)), ([1, 2, 1]) = -M/(r*(-r+2*M)), ([2, 1, 1]) = -(-r+2*M)*M/r^3, ([2, 2, 2]) = M/(r*(-r+2*M)), ([2, 3, 3]) = -r+2*M, ([2, 4, 4]) = (-r+2*M)*sin(theta)^2, ([3, 2, 3]) = 1/r...
[([1, 1, 2]) = -M/(r*(-r+2*M)), ([1, 2, 1]) = -M/(r*(-r+2*M)), ([2, 1, 1]) = -(-r+2*M)*M/r^3, ([2, 2, 2]) = M/(r*(-r+2*M)), ([2, 3, 3]) = -r+2*M, ([2, 4, 4]) = (-r+2*M)*sin(theta)^2, ([3, 2, 3]) = 1/r...
 

The minimal spin connection 

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

Typesetting:-mrow(Typesetting:-ms(
 

> spinConnection:-flattenNonZeroComps();
 

[([1, 1, 2]) = M/r^2, ([1, 2, 1]) = M/r^2, ([3, 2, 3]) = -(-(-r+2*M)/r)^(1/2), ([3, 3, 2]) = (-(-r+2*M)/r)^(1/2), ([4, 2, 4]) = -(-(-r+2*M)/r)^(1/2)*sin(theta), ([4, 3, 4]) = -cos(theta), ([4, 4, 2]) ...
[([1, 1, 2]) = M/r^2, ([1, 2, 1]) = M/r^2, ([3, 2, 3]) = -(-(-r+2*M)/r)^(1/2), ([3, 3, 2]) = (-(-r+2*M)/r)^(1/2), ([4, 2, 4]) = -(-(-r+2*M)/r)^(1/2)*sin(theta), ([4, 3, 4]) = -cos(theta), ([4, 4, 2]) ...
 

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

Typesetting:-mrow(Typesetting:-ms(
 

> riemann:-flattenNonZeroComps();
 

[([1, 2, 1, 2]) = -2*M/(r^2*(-r+2*M)), ([1, 2, 2, 1]) = 2*M/(r^2*(-r+2*M)), ([1, 3, 1, 3]) = -M/r, ([1, 3, 3, 1]) = M/r, ([1, 4, 1, 4]) = -M*sin(theta)^2/r, ([1, 4, 4, 1]) = M*sin(theta)^2/r, ([2, 1, ...
[([1, 2, 1, 2]) = -2*M/(r^2*(-r+2*M)), ([1, 2, 2, 1]) = 2*M/(r^2*(-r+2*M)), ([1, 3, 1, 3]) = -M/r, ([1, 3, 3, 1]) = M/r, ([1, 4, 1, 4]) = -M*sin(theta)^2/r, ([1, 4, 4, 1]) = M*sin(theta)^2/r, ([2, 1, ...
[([1, 2, 1, 2]) = -2*M/(r^2*(-r+2*M)), ([1, 2, 2, 1]) = 2*M/(r^2*(-r+2*M)), ([1, 3, 1, 3]) = -M/r, ([1, 3, 3, 1]) = M/r, ([1, 4, 1, 4]) = -M*sin(theta)^2/r, ([1, 4, 4, 1]) = M*sin(theta)^2/r, ([2, 1, ...
[([1, 2, 1, 2]) = -2*M/(r^2*(-r+2*M)), ([1, 2, 2, 1]) = 2*M/(r^2*(-r+2*M)), ([1, 3, 1, 3]) = -M/r, ([1, 3, 3, 1]) = M/r, ([1, 4, 1, 4]) = -M*sin(theta)^2/r, ([1, 4, 4, 1]) = M*sin(theta)^2/r, ([2, 1, ...
[([1, 2, 1, 2]) = -2*M/(r^2*(-r+2*M)), ([1, 2, 2, 1]) = 2*M/(r^2*(-r+2*M)), ([1, 3, 1, 3]) = -M/r, ([1, 3, 3, 1]) = M/r, ([1, 4, 1, 4]) = -M*sin(theta)^2/r, ([1, 4, 4, 1]) = M*sin(theta)^2/r, ([2, 1, ...
[([1, 2, 1, 2]) = -2*M/(r^2*(-r+2*M)), ([1, 2, 2, 1]) = 2*M/(r^2*(-r+2*M)), ([1, 3, 1, 3]) = -M/r, ([1, 3, 3, 1]) = M/r, ([1, 4, 1, 4]) = -M*sin(theta)^2/r, ([1, 4, 4, 1]) = M*sin(theta)^2/r, ([2, 1, ...
[([1, 2, 1, 2]) = -2*M/(r^2*(-r+2*M)), ([1, 2, 2, 1]) = 2*M/(r^2*(-r+2*M)), ([1, 3, 1, 3]) = -M/r, ([1, 3, 3, 1]) = M/r, ([1, 4, 1, 4]) = -M*sin(theta)^2/r, ([1, 4, 4, 1]) = M*sin(theta)^2/r, ([2, 1, ...
 

The Ricci tensor 

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

Typesetting:-mrow(Typesetting:-ms(
 

The Ricci scalar 

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

OBJECT
 

The Einstein tensor 

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

Typesetting:-mrow(Typesetting:-ms(
 

The Weyl tensor 

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

Typesetting:-mrow(Typesetting:-ms(
 

> weyl:-flattenNonZeroComps();
 

[([1, 2, 1, 2]) = -2*M/r^3, ([1, 2, 2, 1]) = 2*M/r^3, ([1, 3, 1, 3]) = -M*(-r+2*M)/r^2, ([1, 3, 3, 1]) = M*(-r+2*M)/r^2, ([1, 4, 1, 4]) = -M*sin(theta)^2*(-r+2*M)/r^2, ([1, 4, 4, 1]) = M*sin(theta)^2*...
[([1, 2, 1, 2]) = -2*M/r^3, ([1, 2, 2, 1]) = 2*M/r^3, ([1, 3, 1, 3]) = -M*(-r+2*M)/r^2, ([1, 3, 3, 1]) = M*(-r+2*M)/r^2, ([1, 4, 1, 4]) = -M*sin(theta)^2*(-r+2*M)/r^2, ([1, 4, 4, 1]) = M*sin(theta)^2*...
[([1, 2, 1, 2]) = -2*M/r^3, ([1, 2, 2, 1]) = 2*M/r^3, ([1, 3, 1, 3]) = -M*(-r+2*M)/r^2, ([1, 3, 3, 1]) = M*(-r+2*M)/r^2, ([1, 4, 1, 4]) = -M*sin(theta)^2*(-r+2*M)/r^2, ([1, 4, 4, 1]) = M*sin(theta)^2*...
[([1, 2, 1, 2]) = -2*M/r^3, ([1, 2, 2, 1]) = 2*M/r^3, ([1, 3, 1, 3]) = -M*(-r+2*M)/r^2, ([1, 3, 3, 1]) = M*(-r+2*M)/r^2, ([1, 4, 1, 4]) = -M*sin(theta)^2*(-r+2*M)/r^2, ([1, 4, 4, 1]) = M*sin(theta)^2*...
[([1, 2, 1, 2]) = -2*M/r^3, ([1, 2, 2, 1]) = 2*M/r^3, ([1, 3, 1, 3]) = -M*(-r+2*M)/r^2, ([1, 3, 3, 1]) = M*(-r+2*M)/r^2, ([1, 4, 1, 4]) = -M*sin(theta)^2*(-r+2*M)/r^2, ([1, 4, 4, 1]) = M*sin(theta)^2*...
[([1, 2, 1, 2]) = -2*M/r^3, ([1, 2, 2, 1]) = 2*M/r^3, ([1, 3, 1, 3]) = -M*(-r+2*M)/r^2, ([1, 3, 3, 1]) = M*(-r+2*M)/r^2, ([1, 4, 1, 4]) = -M*sin(theta)^2*(-r+2*M)/r^2, ([1, 4, 4, 1]) = M*sin(theta)^2*...
[([1, 2, 1, 2]) = -2*M/r^3, ([1, 2, 2, 1]) = 2*M/r^3, ([1, 3, 1, 3]) = -M*(-r+2*M)/r^2, ([1, 3, 3, 1]) = M*(-r+2*M)/r^2, ([1, 4, 1, 4]) = -M*sin(theta)^2*(-r+2*M)/r^2, ([1, 4, 4, 1]) = M*sin(theta)^2*...
 

The Kretschmann scalar 

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

OBJECT
 

The spin curvature tensor 

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

Typesetting:-mrow(Typesetting:-ms(
 

> spinCurvature:-flattenNonZeroComps();
 

[([1, 2, 1, 2]) = 2*M/r^3, ([1, 2, 2, 1]) = 2*M/r^3, ([1, 3, 1, 3]) = -M*(-(-r+2*M)/r)^(1/2)/r^2, ([1, 3, 3, 1]) = -M*(-(-r+2*M)/r)^(1/2)/r^2, ([1, 4, 1, 4]) = -M*(-(-r+2*M)/r)^(1/2)*sin(theta)/r^2, (...
[([1, 2, 1, 2]) = 2*M/r^3, ([1, 2, 2, 1]) = 2*M/r^3, ([1, 3, 1, 3]) = -M*(-(-r+2*M)/r)^(1/2)/r^2, ([1, 3, 3, 1]) = -M*(-(-r+2*M)/r)^(1/2)/r^2, ([1, 4, 1, 4]) = -M*(-(-r+2*M)/r)^(1/2)*sin(theta)/r^2, (...
[([1, 2, 1, 2]) = 2*M/r^3, ([1, 2, 2, 1]) = 2*M/r^3, ([1, 3, 1, 3]) = -M*(-(-r+2*M)/r)^(1/2)/r^2, ([1, 3, 3, 1]) = -M*(-(-r+2*M)/r)^(1/2)/r^2, ([1, 4, 1, 4]) = -M*(-(-r+2*M)/r)^(1/2)*sin(theta)/r^2, (...
[([1, 2, 1, 2]) = 2*M/r^3, ([1, 2, 2, 1]) = 2*M/r^3, ([1, 3, 1, 3]) = -M*(-(-r+2*M)/r)^(1/2)/r^2, ([1, 3, 3, 1]) = -M*(-(-r+2*M)/r)^(1/2)/r^2, ([1, 4, 1, 4]) = -M*(-(-r+2*M)/r)^(1/2)*sin(theta)/r^2, (...
[([1, 2, 1, 2]) = 2*M/r^3, ([1, 2, 2, 1]) = 2*M/r^3, ([1, 3, 1, 3]) = -M*(-(-r+2*M)/r)^(1/2)/r^2, ([1, 3, 3, 1]) = -M*(-(-r+2*M)/r)^(1/2)/r^2, ([1, 4, 1, 4]) = -M*(-(-r+2*M)/r)^(1/2)*sin(theta)/r^2, (...
[([1, 2, 1, 2]) = 2*M/r^3, ([1, 2, 2, 1]) = 2*M/r^3, ([1, 3, 1, 3]) = -M*(-(-r+2*M)/r)^(1/2)/r^2, ([1, 3, 3, 1]) = -M*(-(-r+2*M)/r)^(1/2)/r^2, ([1, 4, 1, 4]) = -M*(-(-r+2*M)/r)^(1/2)*sin(theta)/r^2, (...
[([1, 2, 1, 2]) = 2*M/r^3, ([1, 2, 2, 1]) = 2*M/r^3, ([1, 3, 1, 3]) = -M*(-(-r+2*M)/r)^(1/2)/r^2, ([1, 3, 3, 1]) = -M*(-(-r+2*M)/r)^(1/2)/r^2, ([1, 4, 1, 4]) = -M*(-(-r+2*M)/r)^(1/2)*sin(theta)/r^2, (...
[([1, 2, 1, 2]) = 2*M/r^3, ([1, 2, 2, 1]) = 2*M/r^3, ([1, 3, 1, 3]) = -M*(-(-r+2*M)/r)^(1/2)/r^2, ([1, 3, 3, 1]) = -M*(-(-r+2*M)/r)^(1/2)/r^2, ([1, 4, 1, 4]) = -M*(-(-r+2*M)/r)^(1/2)*sin(theta)/r^2, (...
 

Object methods 

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

> metric:-getClass(),eval(metric);
tetrad:-getClass(),eval(tetrad);
faraday:-getClass(),eval(faraday);
 

METRIC
METRIC
METRIC
METRIC
 

TETRAD
TETRAD
TETRAD
TETRAD
TETRAD
 

OBJECT
OBJECT
OBJECT
OBJECT
 

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 

- diffGradient() Takes the covariant gradient
- 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();
 

Typesetting:-mrow(Typesetting:-ms(
 

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

[([1, 1, 2]) = -2*M/r^2, ([2, 2, 2]) = -2*M/(-r+2*M)^2, ([3, 3, 2]) = 2*r, ([4, 4, 2]) = 2*r*sin(theta)^2, ([4, 4, 3]) = 2*r^2*sin(theta)*cos(theta)]
[([1, 1, 2]) = -2*M/r^2, ([2, 2, 2]) = -2*M/(-r+2*M)^2, ([3, 3, 2]) = 2*r, ([4, 4, 2]) = 2*r*sin(theta)^2, ([4, 4, 3]) = 2*r^2*sin(theta)*cos(theta)]
 

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

[], true
 

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

[], true
 

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

Typesetting:-mrow(Typesetting:-mfenced(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mn(
 

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

Typesetting:-mrow(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mn(
 

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

LRL
 

> # 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];
 

Typesetting:-mrow(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mrow(Typesetting:-mo(
 

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

Typesetting:-mrow(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mn(
 

 

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.
 

Image