7/24/2019 GRCalcs
1/29
General Relativistic Calculations inMathematica
By George E. Hrabovsky
7/24/2019 GRCalcs
2/29
What I Will Cover0000 What is xAct?0000 What Do We Do Next?0000 Contraction0000 Covariant Derivatives0000 The Second Bianchi Identity0000 Perturbative GR
2 GRCalcs.nb
7/24/2019 GRCalcs
3/29
What is xAct?
This is a very complete system for doing tensor analysis in the Mathematicasystem.
All you need do is open the system:
7/24/2019 GRCalcs
4/29
What Do We Do Next?
Now that we have started things up, there are some things we need to do.
1. We need to define the underlying manifold we are working in. We do this with the
DefManifold command: DefManifold[M, dim, {a, b, c,...}] defines M to be an ndimensional
differentiable manifold with dimension dim (a positive integer or a constant symbol) and
tensor abstract indices a, b, c, ... . DefManifold[M, {M1, ..., Mm}, {a, b, c,...}] defines M to be the
product manifold of previously defined manifolds M1 ... Mm. For backward compatibility dim
can be a list of positive integers, whose length is interpreted as the dimension of the defined
manifold. Here we define a fourdimensional manifold having the indices
a,b,c,d,e, f,g,h,i, j,k,l:
DefManifold[M, 4, {a, b, c, d, e, f, g, h, i, j, k, l }]
**DefManifold: Defining manifold M.
**DefVBundle: Defining vbundle TangentM.
In defining the manifold, we have also defined thevector bundlecalled TangentM, : TMM. This is where our tensors will be.
4 GRCalcs.nb
7/24/2019 GRCalcs
5/29
2. We need to define the metric using the DefMetric command: DefMetric[signdet, metric[a,b],
covd, covdsymbol] defines metric[a, b] with signdet 1 or 1 and associates the covariant
derivative covd[a] to it. Note that we have the convention [a] has a as the subscript, and [a]
has it as the superscript.
DefMetric[- 1, metric[- i, - j], cd, {";", ""}, PrintAs "g"]**DefTensor: Defining symmetric metric tensor metric[-i, -j].
**DefTensor: Defining antisymmetric tensor epsilonmetric[-a, -b, -c, -d].
**DefTensor: Defining tetrametric Tetrametric[-a, -b, -c, -d].
**DefTensor: Defining tetrametric Tetrametric[-a, -b, -c, -d].
**DefCovD: Defining covariant derivative cd[-i].
**DefTensor: Defining vanishing torsion tensor Torsioncd[a, -b, -c].
**DefTensor: Defining symmetric Christoffel tensor Christoffelcd[a, -b, -c].
**DefTensor: Defining Riemann tensor Riemanncd[-a, -b, -c, -d].
**DefTensor: Defining symmetric Ricci tensor Riccicd[-a, -b].
**DefCovD: Contractions of Riemann automatically replaced by Ricci.
**DefTensor: Defining Ricci scalar RicciScalarcd[].
**DefCovD: Contractions of Ricci automatically replaced by RicciScalar.
**DefTensor: Defining symmetric Einstein tensor Einsteincd[-a, -b].
**DefTensor: Defining Weyl tensor Weylcd[-a, -b, -c, -d].
**DefTensor: Defining symmetric TFRicci tensor TFRiccicd[-a, -b].
**DefTensor: Defining Kretschmann scalar Kretschmanncd[].
**DefCovD: Computing RiemannToWeylRules for dim 4
**DefCovD: Computing RicciToTFRicci for dim 4
**DefCovD: Computing RicciToEinsteinRules for dim 4
**DefTensor: Defining weight +2 density Detmetric[]. Determinant.
GRCalcs.nb 5
7/24/2019 GRCalcs
6/29
3. We can define tensors using the DefTensor command: DefTensor[T[a, b, c, ...], {M1, ...}]
defines T to be a tensor field on manifolds and parameters M1,... and the base manifolds
associated to the vector bundles of its indices. DefTensor[T[a, b, c, ...], {M1, ...}, symmetry]
defines a tensor with symmetry given by a generating set or strong generating set of the
associated permutation group. In fact we can define any order of tensor just by specifying theindices. A scalar has no indices so we can define the scalar
DefTensor[s[], M]
**DefTensor: Defining tensor s[].
s
s
a tangent vectorDefTensor[tv[i], M]
**DefTensor: Defining tensor tv[i].
tv[i]
tvi
6 GRCalcs.nb
7/24/2019 GRCalcs
7/29
a covectorDefTensor[cv[- i], M]
**DefTensor: Defining tensor cv[-i].
cv[- i]
cvi
and so on.
GRCalcs.nb 7
7/24/2019 GRCalcs
8/29
We can define tensors by their symmetries or antisymmetries, too. Here we define the tensor
Tijthat is antisymmetric:
DefTensor[T[-i, - j], M, Antisymmetric[{- i, - j}]];
**DefTensor: Defining tensor T[-i, -j].
T[- i, - j]
Tij
T[- j, - i]
Tji
To make this work, sinceMathematicadoes not enforce our symmetry rules, we need to make
it do so by using the ToCanonical command. Lets try it againT[- j, - i] // ToCanonical
-Tij
We can add two such tensors in a way that gives us a 0 result,T[- i, - j] + T[- j, - i]
Tij +Tji
T[- i, - j] + T[- j, - i] // ToCanonical
0
8 GRCalcs.nb
7/24/2019 GRCalcs
9/29
Contraction
We can do some operations. Lets say we have the Riemann tensor Rijkland we want to
contract it using the metric gik. we use the ContractMetric command,metric[i, k]Riemanncd[- i, - j, - k, - l] // ContractMetric
R[]jlMathematicaalso understands that this is the Ricci tensor, Rjl,
metric[i, k]Riemanncd[- i, - j, - k, - l] // ContractMetric // InputForm
Riccicd[-j, -l]
Contracting it again gives us the Ricci scalar,metric[j, l]Riccicd[- j, - l] // ContractMetric // InputForm
RicciScalarcd[]
GRCalcs.nb 9
7/24/2019 GRCalcs
10/29
Covariant Derivatives
The covariant derivative of our tensor, iTjl, is input
cd[- i][T[- j, - l]]
iTjlIf we have multiple covariant derivatives, we would enter them as follows, where @ is the
Map command:cd[- a] @ cd[-b] @ cd[- c] @ T[- d, - e] // ToCanonical
abcTdeTo evaluate this we use the command SortCovDs
cd[- a] @ cd[-b] @ cd[- c] @ T[- d, - e] // ToCanonical // SortCovDs
-R[] l$1032cbe aTdl$1032 -R[] l$1032cbd aTl$1032e -Tl$1030e
bR[
]
l$1030cad
-Tdl$1030
bR[
]
l$1030cae -R[
]
l$1030cae
bTdl$1030 -
R[] l$1030cad bTl$1030e -R[] l$1028bae cTdl$1028 -R[] l$1028bad cTl$1028e +cbaTde -R[] l$1028bac l$1028Tde -R[] l$1032cba l$1032Tde
10 GRCalcs.nb
7/24/2019 GRCalcs
11/29
This is correct, but too difficult to interpret, we add the command ScreenDollarIndices to
put it into a lnaguage we can read instead of just the computer reading itcd[- a] @ cd[-b] @ cd[- c] @ T[- d, - e] // ToCanonical // SortCovDs // ScreenDollarIndices
-R[] fcbe aTdf -R[] fcbd aTfe -Tfe bR[] fcad -Tdf bR[] fcae -R[] fcae bTdf -R[] fcad bTfe -R[] fbae cTdf -R[] fbad cTfe + cbaTde -R[] fbac fTde -R[] fcba fTde
Instead of having to write all of this all of the time we make a sessionwide command$PrePrint= ScreenDollarIndices;
cd[- a] @ cd[-b] @ cd[- c] @ T[- d, - e] // ToCanonical // SortCovDs
-R[] fcbe aTdf -R[] fcbd aTfe -Tfe bR[] fcad -Tdf bR[] fcae -R[] fcae bTdf -R[] fcad bTfe -R[] fbae cTdf -R[] fbad cTfe + cbaTde -R[] fbac fTde -R[] fcba fTde
GRCalcs.nb 11
7/24/2019 GRCalcs
12/29
The Second Bianchi Identity
Here we seek to reproduce the Second Bianchi identity. We redefine our covariant
derivative
DefCovD[CD[- a], {";", ""}]**DefCovD: Defining covariant derivative CD[-a].
**DefTensor: Defining vanishing torsion tensor TorsionCD[a, -b, -c].
**DefTensor: Defining symmetric Christoffel tensor ChristoffelCD[a, -b, -c].
**DefTensor: Defining Riemann tensor
RiemannCD[-a, -b, -c, d]. Antisymmetric only in the first pair.
**DefTensor: Defining non-symmetric Ricci tensor RicciCD[-a, -b].
**DefCovD: Contractions of Riemann automatically replaced by Ricci.
We begin by establishing a termterm1 = Antisymmetrize[CD[- e][RiemannCD[- c, - d, -b, a] ], {- c, - d, - e} ]
1
6cR[] adeb - cR[] aedb - dR[] aceb + dR[] aecb + eR[] acdb - eR[] adcb
We sum these,bianchi2= 3 term1 // ToCanonical
cR[] adeb - dR[] aceb + eR[] acdb
12 GRCalcs.nb
7/24/2019 GRCalcs
13/29
We expand the covariant derivatives in Christoffel symbols:exp1 = bianchi2 // CovDToChristoffel
[]aefR[] fcdb -[]febR[] acdf -[]adfR[] fceb +
[
]fdbR[
]
acef +
[
]fdeR[
]
acfb -
[
]fedR[
]
acfb +
[]acfR[] fdeb -[]fcbR[] adef -[]fceR[] adfb -[]fecR[] afdb -[]fcdR[] afeb +[]fdcR[] afeb + cR[] adeb - dR[] aceb + eR[] acdb
GRCalcs.nb 13
7/24/2019 GRCalcs
14/29
We expand the Riemann tensors in Christoffel symbolsexp2 = exp1 // RiemannToChristoffel
-[]febc[]adf +[]fdbc[]aef +[]aefc[]fdb -
[
]adf
c
[
]feb -
c
d
[
]aeb +
c
e
[
]adb +
[
]feb
d
[
]acf -
[]feb []adg []gcf -[]acg []gdf - c[]adf + d[]acf -[]fcbd[]aef -[]aefd[]fcb +[]aef []fdg []gcb -[]fcg []gdb - c[]fdb + d[]fcb +[]acfd[]feb + dc[]aeb - de[]acb -[]fdb e[]acf +[]fdb []aeg []gcf -[]acg []gef - c[]aef + e[]acf +[]fcbe[]adf -[]fcb []aeg []gdf -[]adg []gef - d[]aef + e[]adf +[]adf e[]fcb -
[]adf []feg []gcb -[]fcg []geb - c[]feb + e[]fcb -
[
]a
cfe[
]f
db +
[]acf []feg []gdb -[]fdg []geb - d[]feb + e[]fdb - ec[]adb +ed[]acb +[]fde []afg []gcb -[]acg []gfb - c[]afb + f[]acb -[]f
ed []afg []gcb -[]acg []gfb - c[]afb + f[]acb -
[]fec-[]afg []gdb +[]adg []gfb + d[]afb - f[]adb -[]fce []afg []gdb -[]adg []gfb - d[]afb + f[]adb -[]f
cd-[]afg []geb +[]aeg []gfb + e[]afb - f[]aeb +
[]fdc
-[]afg []geb +[]aeg []gfb + e[]afb - f[]aeb
14 GRCalcs.nb
7/24/2019 GRCalcs
15/29
We canonicalize this to enforce symmetries and antisymmetries,exp3 = exp2 // ToCanonical
0
Which is what we expected.
cR[]a
bde +dR[]a
be c+eR[]a
bc d = 0
GRCalcs.nb 15
7/24/2019 GRCalcs
16/29
Perturbative GR
We begin this by opening the perturbative package:
7/24/2019 GRCalcs
17/29
We must first establish our metric perturbation, this is because the metric is a vacuum
metric; thus all small perturbations are gravitational waves. We define the metric perturba
tion using the DefMetricPerturbation[the existing metric, name of the perturbation, pertur
bation parameter]DefMetricPerturbation[metric, pert,]**DefParameter: Defining parameter .**DefTensor: Defining tensor pert[LI[order], -a, -b].
We can tellMathematicato write the perturbation using the traditional notation h,PrintAs[pert] ^= "h";
A secondorder perturbation in the metric is then writtenpert[LI[2], - a, -b]
h2ab
So the firstorder perturbation of the metricgabisPerturbation[metric[- a, -b], 1]
h1ab
GRCalcs.nb 17
7/24/2019 GRCalcs
18/29
for gabwe have,Perturbation[metric[a, b], 1]
gab What? What is ? It turns out that Mathematicadoes not know how to perform a perturba
tion on the inverse metric. We need to use the ExpandPerturbation command,Perturbation[metric[a, b], 1] // ExpandPerturbation
-h1ab
This is not too impressive, lets try a fourthorder perturbationPerturbation[metric[a, b], 4] // ExpandPerturbation
24h1ac
h1 dc h
1 ed h
1 be - 12h
1 dc h
1 bd h
2ac + 6h2ac
h2 bc -
12h1ac
h1 bd h
2 dc - 12h
1ach1 dc h
2 bd
+ 4h1 bc h
3ac + 4h1ac
h3 bc -h
4ab
Lets examine the thirdorder perturbed metric
Perturbed[metric[- a, -b], 3]
gab + h1ab +
1
22 h2ab +
1
63 h3ab
18 GRCalcs.nb
7/24/2019 GRCalcs
19/29
and the inverse metricPerturbed[metric[a, b], 3] // ExpandPerturbation
gab - h1ab + 12
2 2h1ac h1 bc -h2ab +
1
63 -6h1ac h1 dc h1 bd + 3h1 bf h2af + 3h1ae h2 be -h3ab
Jolyon Bloomfield [5] produced a method of extracting only the firstorder terms of the
expansion, since is assumed to be small, where we can write the metric as the sum of a
linearized metric and a perturbed metric, gab= g0
ab+ habwe adapt it for our usefirstorderonly= pert[LI[n_], __] 0 /; n > 1;
Perturbed[metric[- a, -b], 3] /. firstorderonly
gab + h1ab
Given an action we can derive an equation of motion. First we need to establish our scalar
field,DefTensor[sf[], M, PrintAs ""]**DefTensor: Defining tensor sf[].
GRCalcs.nb 19
7/24/2019 GRCalcs
20/29
We now define the perturbations of the scalar field,DefTensorPerturbation[pertsf[LI[order]], sf[], M, PrintAs ""]**DefTensor: Defining tensor pertsf[LI[order]].
We now define the potential and the Planck mass,DefScalarFunction[V]
DefConstantSymbolmassP, PrintAs " mp"
**DefScalarFunction: Defining scalar function V.
**DefConstantSymbol: Defining constant symbol massP.
Now we need to construct the LagrangianL = Sqrt[- Detmetric[]]massP22 RicciScalarcd[] - 1 / 2 cd[-b][sf[]]cd[b][sf[]] -V[sf[]]
-g mp2 R[]
2- V[] - 1
2b b
20 GRCalcs.nb
7/24/2019 GRCalcs
21/29
We vary the fieldsvarL = L // Perturbation
- [g] mp2 R[]2
- V[] - 12
b b 2 -g +
-g 12mp
2 [R[]] + 12
-b b -1;b b -1 V[]
We expand thisvarL = L // Perturbation // ExpandPerturbation
- gh1 aa
mp2 R[]2
- V[] - 12
b b 2 -g + -g 12mp
2 -h1ac R[]ac +
gac 1
2-h1dd;c;a -h1dc;d;a +h1 ;dc d ;a +
1
2h1dc;a;d +h1da;c;d -h1 ;dc a ;d +
1
2-1;bb - b gbe 1;e -h1be e -1 V[]
GRCalcs.nb 21
7/24/2019 GRCalcs
22/29
We perform the metric contractionsvarL = L // Perturbation // ExpandPerturbation // ContractMetric
-1
2mp
2 -g
h1ab R[]ab +
1
4mp
2 -g
h1 aa R[] -
1
2-g
h1 aa V[] -
1
4mp
2 -g h1b ;ab ;a - 14mp
2 -g h1ba;b;a + 14mp
2 -g h1a ;bb ;a +1
2-g
h1ba a b + 1
2mp
2 -g
h1ba
;a;b -1
4mp
2 -g
h1a ;b
a ;b -
1
2-gb 1;b - 1
2-g 1;b b -
1
4-g
h1 aa b b - -g 1 V[]
? RicciTo*
xAct`xTensor`
RicciToEinstein RicciToTFRicci
RicciToEinstein[expr, covd]expands expr expressingall Ricci tensors of covd in terms of the Einstein and RicciScalar tensors
of covd. If the second argument is a list of covariant derivatives the command is applied sequentially on expr. RicciToEinstein [expr]expands all Ricci tensors.
Then we enforce the symmetriesvarL = L // Perturbation // ExpandPerturbation // ContractMetric // ToCanonical
-1
2mp
2 -g
h1ba R[]ba +
1
4mp
2 -g
h1b
bR[] -
1
2-g
h1b
bV[] - 1
2mp
2 -g
h1b ;a
b ;a +
1
2mp
2 -g
h1ba
;b;a -
-gb 1;b + 1
2-g
h1baa b -
1
4-g
h1a
ab b - -g 1 V[]
22 GRCalcs.nb
7/24/2019 GRCalcs
23/29
The scalar equation of motion is then found by taking the variational derivatives of the
scalar field and set them equal to 00 == VarD[pertsf[LI[1]], cd][varL] / Sqrt[- Detmetric[]]
0
1
-g 1
1
-g
a
a
-
1
1
-gV[
]
we enforce the Kronecker delta0 == VarD[pertsf[LI[1]], cd][varL] / Sqrt[- Detmetric[]] /. delta[- LI[1], LI[1]] 1
0 -gaa - -gV[]
-g
We canonicalize it0 == VarD[pertsf[LI[1]], cd][varL] / Sqrt[- Detmetric[]] /.
delta[- LI[1], LI[1]] 1 // ToCanonical0
aa
- V[
]
There we have it.
GRCalcs.nb 23
7/24/2019 GRCalcs
24/29
We can get the tensor equation of motion,vartf = 2 (-VarD[pert[LI[1], a, b], cd][varL] / Sqrt[- Detmetric[]])
1
-g2
1
2mp
2 11 -gR[]ab -1
4mp
2 11 -ggabR[] +
1
211 -ggabV[] +
1
411 -ggab c c -
1
211 -ggacgbd c d
This is a mess, so we begin enforcing the Kronecker deltasvartf =
2(-VarD[pert[LI[1], a, b], cd][varL] / Sqrt[- Detmetric[]] /. delta[- LI[1], LI[1]] 1)1
-g2
1
2mp
2 -gR[]ab -
1
4mp
2 -gg
abR[] +
1
2-gg
abV[] +1
4-gg
ab c c -1
2-gg
acg
bd c d
24 GRCalcs.nb
7/24/2019 GRCalcs
25/29
We now expand by expressing all Ricci tensors of covariant derivatives in terms of Einstein
tensors and Ricci scalarsvartf =
2(-VarD[pert[LI[1], a, b], cd][varL] / Sqrt[- Detmetric[]] /. delta[- LI[1], LI[1]] 1 //
SeparateMetric[metric] // RicciToEinstein)1
-g2 -
1
4mp
2 -gg
abR[] +1
2mp
2 -g G[]ab +
1
2gbaR[] +
1
2-gg
abV[] -1
2-ga b + 1
4-gg
abgcd c d
We expand thisvartf =
2(-VarD[pert[LI[1], a, b], cd][varL] / Sqrt[- Detmetric[]] /. delta[- LI[1], LI[1]] 1 //SeparateMetric[metric] // RicciToEinstein) // Expand
mp2 G[
]ab -
1
2
mp2 g
abR[
] +
1
2
mp2 g
baR[
] +gabV[
] -
a
b
+1
2
gabgcd
c
d
GRCalcs.nb 25
7/24/2019 GRCalcs
26/29
Then we enforce the symmetries,vartf =
2(-VarD[pert[LI[1], a, b], cd][varL] / Sqrt[- Detmetric[]] /. delta[- LI[1], LI[1]] 1 //SeparateMetric[metric] // RicciToEinstein) //
Expand// ContractMetric // ToCanonical
mp2 G[]ab +gabV[] - a b +
1
2gab c c
We set this equal to 0,0 vartf
0mp2 G[]ab +gabV[] - a b +1
2gab c c
Here we get the conservation of energyeterm = IndexCollect[cd[a] @ vartf // ToCanonical, CD[-b][sf[]]] // Simplify
b(- aa + V[])
26 GRCalcs.nb
7/24/2019 GRCalcs
27/29
then0 eterm
0 b(- aa + V[])this is degenerate with the scalar equation of motion
0 aa - V[]
GRCalcs.nb 27
7/24/2019 GRCalcs
28/29
Bibliography
[1] M. Nakahara, (2003), Geometry, Topology, and Physics, 2nd Edition, Taylor and Francis
Group.
[2] Theodore Frankel, (2012), The Geometry of Physics, 3rd Edition, Cambridge UniversityPress
[3] Jose M. MartinGarcia, (2009), xAct Intro
[4] B. F. Schutz, (1984), The Use of Perturbation and Approximation Methods in General
Relativity. In: Relativistic Astrophysics and Cosmology: Proceedings of the GIFT Interna
tional Seminar on Theoretical Physics, (Eds.) Fustero, Xavier; Verdaguer, Enric; Singapore:
World Scientific 3598 (1984)
[5] Jolyon Bloomfield, (2013), xAct Tutorial
xAct can be found at the website: http://www.xact.es/index.html
28 GRCalcs.nb
7/24/2019 GRCalcs
29/29
Thank You for Attending!
GRCalcs.nb 29