g_ - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Physics[g_] - The g_ tensor

Calling Sequence

g_[μ,ν]

g_[μ,ν, matrix]

g_[keyword]

convert(expression, g_)

Parameters

μ, ν

-

the indices, as names representing integer numbers between 0 and the spacetime dimension, they can also be the numbers themselves

matrix

-

optional, returns the matrix form for the given (covariant or contravariant) indices; if passed without indices it returns the covariant metric

keyword

-

optional, it can be definition, determinant, line_element, matrix, nonzero, trace or any portion of a known metric name to launch a search in the metric's database

expression

-

an algebraic expression involving tensors (e.g. Christoffel) to be rewritten in terms of the metric g_ and its derivatives

Description

• 

The g_[mu, nu], displayed as gμ,ν (without _ in between g and its indices), is a computational representation for the spacetime metric tensor. When Physics is loaded, the dimension of spacetime is set to 4 and the metric is automatically set to be galilean, representing a Minkowski spacetime with signature (-, -, -, +), so time in the fourth place.

• 

When working in curvilinear coordinates so that the components of the Christoffel symbols are not zero it is sometimes convenient to rewrite tensorial expressions in terms of the metric g_ and its derivatives. For example, this is the case of the Christoffel symbols and any of the general relativity tensors that are defined in terms of them. For this purpose you can use convert(expression, g_) - see the Examples section.

• 

When the indices of g_ assume integer values, it is expected they are between 0 and the spacetime dimension and the corresponding value of g_ is returned. The values 0 and 4, or for the case any dimension set for the spacetime, represent the same object. When the indices have symbolic values, say as in μ,ν, if μ=ν g_ returns the dimension of spacetime when μ is a spacetime index, or the dimension of space when μ is a space index. If the system can prove that μν (e.g. via assumptions), g_ returns zero whenever the metric is diagonal. Otherwise g_ returns unevaluated, after normalizing its indices taking into account that the spacetime metric is symmetric.

• 

You can change the value of the metric g_ in different ways, using Setup or, when choosing a predefined set of values, you can also change the metric using g_ itself, indexing it with the related metric name; for example as in g_[Minkowski]. The predefined sets are: arbitrary, Euclidean, Minkowski, Schwarzschild, Tolman or related to any of the metrics of the book "Exact Solutions of Einstein's Field Equations" - see references at the end. Note that you can pass the keyword incomplete or misspelled, in which case a searchtext is performed among the keywords understood by g_ and if a match is found the metric is set accordingly, or if many matches are found then corresponding information is displayed on the screen. See the Examples section. Using predefined sets, either through Setup or g_, automatically sets the necessary systems of coordinates and differentiation variables for the spacetime differentiation operator d_ accordingly.

• 

Any of the 991 metrics of the book "Exact Solutions of Einstein's Field Equations" can also be load by indexing g_ with a list of three numbers, for example as in g_[[12, 16, 1]], respectively representing the book's chapter where the metric is found, the equation number and the case.

• 

Computations performed with the Physics package commands take into account Einstein's sum rule for repeated indices - see `.` and Simplify. The distinction between covariant and contravariant indices in the input of tensors is done by prefixing contravariant ones with ~, say as in ~mu; in the output, contravariant indices are displayed as superscripts. For contracted indices, you can enter them one covariant and one contravariant. Note however that - provided that the spacetime metric is galilean (Euclidean or Minkowski), or the object is a tensor also in curvilinear coordinates - this distinction in the input is not relevant, and so contracted indices can be entered as both covariant or both contravariant, in which case they will be automatically rewritten as one covariant and one contravariant. Tensors can have spacetime and space indices at the same time. To change the type of letter used to represent spacetime or space indices see Setup.

• 

Note: since Maple 2019, g_[mu, ~nu], where one of its indices is contravariant as in ~nu while the other remains covariant, is displayed using the δ greek letter, as δμν, as is standard in physics textbooks. Also, KroneckerDelta[mu, nu] is not considered a tensor (of type Physics:-Library:-PhysicsType:-Tensor), even if μ and ν are letters representing tensor indices, unless one of such indices is contravariant as in ~nu, while the other remains covariant, in which case KroneckerDelta[mu, ~nu] is automatically transformed into the spacetime metric g_[mu, nu], which is a tensor.

• 

During a Maple session, the value of any component of the general relativity tensors of Physics, that is: Christoffel, the covariant derivative D_, Einstein, Ricci, Riemann and Weyl, automatically follow the value or any changes introduced in the components of g_, the spacetime metric, provided these changes are made using Setup or g_ itself.

• 

Besides being indexed with two indices, g_ accepts the following keywords as an index:

– 

definition: when passed alone, g_ returns its definition, that is an equation with the metric on the left-hand side and the matrix form of the metric on the right-hand side, the same as when you enter the metric without indices (g_[]).

– 

determinant: when passed alone, g_ returns the determinant of the all-covariant metric g[mu, nu] . If this keyword is passed together with indices, that can be covariant or contravariant, the resulting determinant takes into account the character of the indices.

– 

line_element: (synonym: lineelement) when passed alone, g_ returns the line element for the current metric expressing the differentials of the coordinates using d_.

– 

matrix: (synonym: Matrix, array, Array, or no indices whatsoever, as in g_[]) returns a Matrix that when indexed with numerical values from 1 to the dimension of spacetime it returns the value of each of the components of g_. If this keyword is passed together with indices, that can be covariant or contravariant, the resulting Matrix takes into account the character of the indices.

– 

nonzero: returns a set of equations, with the left-hand side as a sequence of two positive numbers identifying the element of g__μ,ν and the corresponding value on the right-hand side. Note that this set is actually the output of the ArrayElems command when passing to it the Matrix obtained with the keyword matrix.

– 

<metric name>: some predefined sets of values for the spacetime metric can be used by giving the metric name or a portion of it; currently these are Euclidean, Minkowski, Tolman, Schwarzschild and the metrics of Chapter 12 of "Exact Solutions of Einstein's Field Equations" (second edition).

• 

Some automatic checking and normalization are carried out each time you enter g_[...]. The checking is concerned with possible unexpected values of the indices. The automatic normalization takes into account the symmetry of g_[mu,nu] with respect to interchanging the positions of the indices mu and nu.

• 

The %g_ command is the inert form of g_, so it represents the same tensor but entering it does not result in performing any computation. To perform the related computations as if %g_ were g_, use value.

Examples

withPhysics&colon;

Setupmathematicalnotation=true

mathematicalnotation=true

(1)

When Physics is initialized, the default spacetime metric is of Minkowski type. You can see the metric querying Setup, as in Setup(metric), or directly entering the metric as g_[], with no indices

g_

gμ,ν=

(2)

The corresponding line element

g_line_element

Systems of spacetime coordinates are:X=x1&comma;x2&comma;x3&comma;x4

&DifferentialD;x12&DifferentialD;x22&DifferentialD;x32+&DifferentialD;x42

(3)

The default spacetime of the Physics package is a Minkowski spacetime with dimension 4, so the values 0 and 4 represent the same object

g_0,0=g_4,4

1=1

(4)

g_0,3

0

(5)

The symmetry property of g_ is automatically taken into account when the indices have symbolic values

g_μ,νg_ν,μ

0

(6)

By default, spacetime indices are represented by greek letters and the dimension of spacetime is 4 - you can query about that via

Setupspacetimeindices&comma;dimension

dimension=4&comma;spacetimeindices=greek

(7)

Set the space indices (not the spacetime indices) to be represented by lowercaselatin letters till h

Setupspaceindices=lowercaselatin_ah

spaceindices=lowercaselatin_ah

(8)

The trace of g_ is equal to the dimension; note the use of the sum rule for repeated indices, both for spacetime and space only indices

g_μ,ν

gμ,ν

(9)

eval&comma;μ=ν

4

(10)

g_a,b

ga,b

(11)

eval&comma;a=b

3

(12)

Check now the nonzero components of Christoffel, used to construct the g_ tensor entering the definition of g_: because the default spacetime is of Minkowski type, there are none

Christoffelnonzero

Γα,μ,ν=

(13)

Hence

Christoffelμ,α,β

0

(14)

and the same is valid for all the general relativity tensors defined in terms of Christoffel and derivatives of the metric g_.

To set the scenario as a curved spacetime set the metric using Setup, for instance indicating the square of the spacetime interval. This can be done directly from g_, choose for example the keyword Tolman; it automatically implies on setting spherical coordinates as the differentiation variables for d_

g_Tolman

_______________________________________________________

Systems of spacetime coordinates are:X=r&comma;θ&comma;φ&comma;t

Default differentiation variables for d_, D_ and dAlembertian are:X=r&comma;θ&comma;φ&comma;t

The Tolman metric in coordinates r&comma;θ&comma;φ&comma;t

Parameters: Rt&comma;r&comma;Er

Signature: - - - +

_______________________________________________________

gμ,ν=

(15)

The corresponding line element

g_line_element

rRt&comma;r2&DifferentialD;r21+2ErRt&comma;r2sinθ2&DifferentialD;φ2+&DifferentialD;θ21+2Er+&DifferentialD;t2

(16)

So now

g_μ,ν

gμ,ν

(17)

g_1,1

rRt&comma;r21+2Er

(18)

Or for the contravariant components (note you indicate the contravariant character of index prefixing with ~)

g_~1,~1

1+2ErrRt&comma;r2

(19)

The matrix form: all of g_[], g_[matrix] and g_[mu, nu, matrix] return the all-covariant matrix

g_μ,ν,matrix

gμ,ν=

(20)

Or, for the matrix components of the all contravariant gμ,ν, which as a matrix is equal to the inverse of the all-covariant gμ,ν,

g_~mu,~nu,matrix

gμ,νμ,ν=

(21)

The metric can also be set using Setup in different ways. Here we enter it by passing the square of the spacetime interval, also called the line element. Because the spacetime coordinates were automatically set to spherical when entering g_[Tolman] you do not need to set the coordinates again. To query about the coordinates use Setup or Coordinates:

Setupcoordinates&comma;differentiation

* Partial match of 'differentiation' against keyword 'differentiationvariables'

Systems of spacetime coordinates are:X=r&comma;θ&comma;φ&comma;t

Default differentiation variables for d_, D_ and dAlembertian are:X=r&comma;θ&comma;φ&comma;t

_______________________________________________________

coordinatesystems=X&comma;differentiationvariables=X

(22)

Coordinates

Systems of spacetime coordinates are:X=r&comma;θ&comma;φ&comma;t

X

(23)

Set now the metric to be

ds2r2dtheta2+r2sinθ2dphi22dtdr2kr&comma;t2dt2

ds2r2d&theta;2+r2sinθ2d&phi;22dtdr2kr&comma;t2dt2

(24)

Setupmetric=ds2

_______________________________________________________

Coordinates: r&comma;θ&comma;φ&comma;t. Signature: - - - +

_______________________________________________________

gμ,ν=

_______________________________________________________

metric=1&comma;4=−1&comma;2&comma;2=r2&comma;3&comma;3=r2sinθ2&comma;4&comma;4=2kr&comma;t2

(25)

(Note that this equation in the output by Setup can be directly used as input for Setup; this is useful to perform minor changes to the metric when desired.)

g_1,1

0

(26)

g_~1,~1

2kr&comma;t2

(27)

The determinant of the all-covariant metric

g_determinant

r4sinθ2

(28)

The nonzero components

g_nonzero

gμ,ν=1&comma;4=−1&comma;2&comma;2=r2&comma;3&comma;3=r2sinθ2&comma;4&comma;4=2kr&comma;t2

(29)

The nonzero components of the inverse of the metric, that is, the all-contravariant gμ,ν

g_~mu,~nu,nonzero

gμ,νμ,ν=1&comma;1=2kr&comma;t2&comma;1&comma;4=−1&comma;2&comma;2=1r2&comma;3&comma;3=cscθ2r2

(30)

The general relativity tensors, or expressions involving them, can be expressed in terms of the metric g_ and its derivatives. For that purpose use convert(... g_) as in

Christoffelμ,α,β

Γμ,α,β

(31)

convert&comma;g_

βgα,μ2+αgβ,μ2μgα,β2

(32)

Define a tensor A for illustration purposes

DefineA

Defined objects with tensor properties

A&comma;μ&comma;γμ&comma;σμ&comma;Rμ,ν&comma;Rμ,ν,α,β&comma;Cμ,ν,α,β&comma;μ&comma;gμ,ν&comma;γa,b&comma;Γμ,ν,α&comma;Gμ,ν&comma;εα,β,μ,ν&comma;Xμ

(33)

The covariant derivative of the contravariant vector AνX and its expansion, or rewriting in terms of d_,g_ or Christoffel symbols

D_μA~nuX

μAννX

(34)

expand

μAννX+Γνα,μνα,μAααX

(35)

convert&comma;d_

μAννX+Γνα,μνα,μAααX

(36)

convert&comma;g_

μAννX+gβ,νβ,νμgα,β+αgβ,μβgα,μAααX2

(37)

convert&comma;Christoffel

μAννX+gβ,νβ,νΓβ,α,μAααX

(38)

Simplify

ΓνμανμαAαX+μAννX

(39)

Alternatively, spacetime derivatives of the metric can be expressed in terms of Christoffel symbols

d_μg_α,β

μgα,β

(40)

convert&comma;Christoffel

Γβ,α,μ+Γα,β,μ

(41)

In the same line, all of Einstein, Ricci, Riemann and Weyl tensors can be expressed in terms of Christoffel symbols, and so in terms of the metric g_ and its derivatives, for instance,

Ricciα,β

Rα,β

(42)

convert&comma;Christoffel

μΓμα,βμα,ββΓμα,μμα,μ+Γνα,βνα,βΓμμ,νμμ,νΓνα,μνα,μΓμβ,νμβ,ν

(43)

convert&comma;g_

μgμ,νμ,νβgα,ν+αgβ,ννgα,β2+gμ,νμ,νβμgα,ν+αμgβ,νμνgα,β2βgμ,νμ,ναgμ,ν2gμ,νμ,ναβgμ,ν2+gλ,νλ,νβgα,λ+αgβ,λλgα,βgκ,μκ,μνgκ,μ4gλ,νλ,νμgα,λ+αgλ,μλgα,μgκ,μκ,μνgβ,κ+βgκ,νκgβ,ν4

(44)

To compute with a representation for g_ without actually performing the operation, use the inert form %g_. To afterwards perform the operation use value

%g_~1,1

δ1111

(45)

value

1

(46)

It is possible to set the metric searching the database of DifferentialGeometry directly from g_. For example

g_sik

_______________________________________________________

____________________________________________________________

[12, 34, 1] = [Authors = [Kaigorodov (1962), Cahen (1964), Siklos (1981), Ozsvath (1987)], PrimaryDescription = Einstein, SecondaryDescription = [Homogeneous], Comments = [All metrics with _epsilon <> 0 are equivalent to the cases _epsilon = +1, -1, _epsilon = 0 is anti-deSitter space]]

____________________________________________________________

[12, 35, 1] = [Authors = [Kaigorodov (1962), Cahen (1964), Siklos (1981), Ozsvath (1987)], PrimaryDescription = Einstein, SecondaryDescription = [Homogeneous, SimpleTransitive]]

____________________________________________________________

[12, 38, 1] = [Authors = [Siklos (1985)], PrimaryDescription = PureRadiation, SecondaryDescription = [Homogeneous, PureRadiation], Comments = [Generic k value, k <> -1 (see [12, 6, 1]), 1/2 (see [12,38,2]), 3/2 (see [12,38, 5]), 2 (see [12,38, 3] and [12, 38, 4]). Note the k = 1/2 is Petrov type "O" .]]

____________________________________________________________

[12, 38, 2] = [Authors = [Siklos (1985)], PrimaryDescription = PureRadiation, SecondaryDescription = [PureRadiation, Homogeneous], Comments = [This is k = 1/2 in [12, 38, 1]. This is of Petrov type "O"]]

____________________________________________________________

[12, 38, 3] = [Authors = [Siklos (1985)], PrimaryDescription = EinsteinMaxwell, SecondaryDescription = [PureRadiation, Homogeneous], Comments = [This is _k = 2 and _epsilon = 1 in [12, 38, 1]. Only _epsilon = 1 gives a Maxwell field]]

____________________________________________________________

[12, 38, 4] = [Authors = [Siklos (1985)], PrimaryDescription = PureRadiation, SecondaryDescription = [PureRadiation, Homogeneous], Comments = [This is _k = 2 and _epsilon = -1 in [12, 38, 1]. Only _epsilon = 1 gives a Maxwell field]]

____________________________________________________________

[12, 38, 5] = [Authors = [Siklos (1985), Nariai(1950)], PrimaryDescription = Einstein, SecondaryDescription = [Homogeneous], Comments = [This is k = 3/2 in [12, 38, 1]. It is equivalent to [12, 34, 1]]]

____________________________________________________________

[13, 64, 1] = [Authors = [Siklos (1981)], PrimaryDescription = Einstein, SecondaryDescription = []]

____________________________________________________________

[13, 64, 3] = [Authors = [Siklos (1981)], PrimaryDescription = Einstein, SecondaryDescription = [], Comments = [See also (13, 64, 4) for Riemannian orbits]]

____________________________________________________________

[13, 64, 4] = [Authors = [Siklos (1981)], PrimaryDescription = Einstein, SecondaryDescription = [], Comments = [See also (13, 64, 3) for PseudoRiemannian orbits]]

____________________________________________________________

[13, 65, 1] = [Authors = [Siklos (1981)], PrimaryDescription = Einstein, SecondaryDescription = [], Comments = [We can use the transformation x -> - x to assume the parameter _b > 0, A boost and a spatial rotation are required to take the null tetrad to an adapted null tetrad]]

____________________________________________________________

[13, 67, 1] = [Authors = [Siklos (1981)], PrimaryDescription = Einstein, SecondaryDescription = [TwistingSolution]]

____________________________________________________________

[13, 67, 2] = [Authors = [Siklos (1981)], PrimaryDescription = Einstein, SecondaryDescription = [TwistingSolution]]

____________________________________________________________

[38, 1, 1] = [Authors = [Siklos (1981)], PrimaryDescription = Hypersurface-Homogeneous, SecondaryDescription = [AlgebraicallySpecial]]

Found more than one match for the keyword 'sik', as seen above. Please refine your 'keyword' or re-enter the metric g_... with the list of three numbers identifying the metric, for example as in g_12&comma;34&comma;1 or Setupmetric=12&comma;34&comma;1

(47)

You can now refine the search accordingly, for example choose and automatically set the metric [12, 38, 1] including the corresponding coordinates

g_12&comma;38&comma;1

_______________________________________________________

Systems of spacetime coordinates are:X=v&comma;y&comma;z&comma;u

Default differentiation variables for d_, D_ and dAlembertian are:X=v&comma;y&comma;z&comma;u

The Siklos (1985) metric in coordinates v&comma;y&comma;z&comma;u

Parameters: k&comma;ε&comma;Λ&comma;&kappa;0

Comments: G&ExponentialE;n&ExponentialE;rⅈc k valu&ExponentialE;, k <> -1 (s&ExponentialE;&ExponentialE; [12, 6, 1]), 1/2 (s&ExponentialE;&ExponentialE; [12,38,2]), 3/2 (s&ExponentialE;&ExponentialE; [12,38, 5]), 2 (s&ExponentialE;&ExponentialE; [12,38, 3] an&DifferentialD; [12, 38, 4]). Not&ExponentialE; th&ExponentialE; k = 1/2 ⅈs P&ExponentialE;trov typ&ExponentialE; "O" .

Domain: 0<y

Assumptions: ε=−1&comma;ε=1&comma;0<&kappa;0&comma;Λ<0

Resetting the signature of spacetime from - - - + to + + + - in order to match the signature in the database of metrics

_______________________________________________________

gμ,ν=

(48)

Note the redefinition of the signature: basically all metrics in the database follow the conventions found in the book Exact Solutions of Einstein's Field Equations (reference at the end), where the signature is (+ + + -).

The simplification of contracted indices is normally performed using Simplify but you can also perform it using the `.` operator.  Define first some spacetime tensors.

DefineA&comma;B

Defined objects with tensor properties

B&comma;Aνν&comma;μ&comma;γμ&comma;σμ&comma;Rμ,ν&comma;Rμ,ν,α,β&comma;Cμ,ν,α,β&comma;μ&comma;gμ,ν&comma;γa,b&comma;Γμ,ν,α&comma;Gμ,ν&comma;Τμ,ν&comma;εα,β,μ,ν&comma;Xμ

(49)

Compare the difference between `*` and `.`

g_α,μAμ

Aμδαμαμ

(50)

g_α,μ·Aμ

Aα

(51)

So g_[alpha, mu] . A[mu] equivalent to Simplify(g_[alpha, mu] * A[mu], indices). This functionality is particularly useful when handling larger expressions where you want contraction to be simplified only in some places. Consider the following product

g_α,μAμg_α,νBν

AμBνδαμαμgα,να,ν

(52)

You can always Simplify the whole product, as in

Simplify&comma;indices

AνBνν

(53)

Using Physics[`.`], however, you can achieve either the same, or any more selective simplification. Replacing the first `*` by `.`,

g_α,μ·Aμg_α,νBν

AαBνgα,να,ν

(54)

Likely (note the parenthesis to indicate the desired order of precedence between `.` and `*`)

g_α,μAμg_α,ν·Bν

BαAμgα,μα,μ

(55)

and replacing `*` and `.` in the middle of the expression,

g_α,μAμ·g_α,νBν

AνBνν

(56)

When one of the sides of `.` is a nested expression, the simplification of contracted indices is performed recursively, compare for instance

g_α,μAμ+Bμ

Aμ+Bμδαμαμ

(57)

g_α,μ·Aμ+Bμ

Aα+Bα

(58)

Set the spacetime metric to be the Schwarzschild metric and consider the contraction of all the indices of the Riemann tensor

g_sc

_______________________________________________________

Systems of spacetime coordinates are:X=r&comma;θ&comma;φ&comma;t

Default differentiation variables for d_, D_ and dAlembertian are:X=r&comma;θ&comma;φ&comma;t

The Schwarzschild metric in coordinates r&comma;θ&comma;φ&comma;t

Parameters: m

Signature: + + + -

_______________________________________________________

gμ,ν=

(59)

Riemannα,β,μ,νRiemannα,β,μ,ν

Rα,β,μ,νRα,β,μ,να,β,μ,ν

(60)

Riemannα,β,μ,ν·Riemannα,β,μ,ν

48m2r6

(61)

Note: since Maple 2019, KroneckerDelta[mu, nu] is not considered a tensor (of type Physics:-Library:-PhysicsType:-Tensor), even if μ and ν are letters representing tensor indices. Consequently, in all cases, the following does not return the trace, but the number 1

KroneckerDeltaμ,μ

1

(62)

%KroneckerDeltaμ,μ

δμ,μ

(63)

value

1

(64)

KroneckerDeltaμ,ν

δμ,ν

(65)

type&comma;Physics:-Library:-PhysicsType:-Tensor

false

(66)

Care should be taken, however, if you happen to index KroneckerDelta with one index covariant and the other contravariant (preceded by ~), in which case KroneckerDelta[mu, ~nu] is automatically transformed into the spacetime metric g_[mu, ~nu] (both displayed with the δ greek letter as is standard in physics textbooks), for which g[mu, ~mu], with the index repeated, represents its trace, equal to the spacetime dimension

KroneckerDeltaμ,~nu=g_μ,~nu

δμνμν=δμνμν

(67)

lprint

Physics:-g_[mu,~nu] = Physics:-g_[mu,~nu]

eval&comma;μ=ν

4=4

(68)

assumingμ=ν

4=4

(69)

See Also

`.`, ArrayElems, Christoffel, convert, Coordinates, D_, d_, DifferentialGeometry[Tensor][g_], Einstein, Matrix, Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists, Ricci, Riemann, Setup, Typesetting, value, Weyl

References

  

Landau, L.D., and Lifshitz, E.M. The Classical Theory of Fields, Course of Theoretical Physics Volume 2, fourth revised English edition. Elsevier, 1975.

  

Stephani, H., Kramer, D., MacCallum, M., Hoenselaers, C. Herlt, E.  Exact Solutions of Einstein's Field Equations, Cambridge Monographs on Mathematical Physics, second edition. Cambridge University Press, 2003.

Compatibility

• 

The Physics[g_] command was updated in Maple 2019.