Introduction to xAct

xAct suite

Quit (** To make sure we have a clean Kernel **)

What are the relevant packages?

The xAct suite contains a series of packages that allow us to do tensor algebra with computers 
	- It performs simplification of tensorial a expressions in a quite efficient way
	- It is particularly useful for calculations with gravity
	
For FRG/ASQG calculations, one usually have to deal with multiple packages that are part of the xAct suite:
	- xPerm -> Manipulation of groups of permutations;
	- xTensor -> Abstract tensor computations;
	- xPert -> Tensor perturbations;
	- Invar -> Manipulations with Riemann tensors;
	- SymManipulator -> Package to handle symmetrization of tensorial expressions;
	- xTras -> Field-theory inspired add-on for xAct (it contains the very powerful function ‘CollectTensors’);
	
The packages that are part of the xAct suit obeys a certain hierarchy. Thus, some of the packages will automatically load others to make sure they will work in the appropriate way. In particular, xTras automatically loads the other packages that are relevant for us.

** For calculations with Fermions and non-Abelian gauge fields, you can also can advantage of FieldsX (also part of the xAct suite)

Loading xTras

<<xAct`xTras`

Defining Manifolds, Tensors and all that

Quit (** To reinitialize the Kernel **)

Loading xTras

We can avoid it to print all this information by using a “Block”:

Block[{Print},<<xAct`xTras`]

Defining a Manifold

The first thing we need to do when we start a xAct session is to define a Manifold. This can be done with the function ‘DefManifold’

?DefManifold

DefManifold[SpaceTime,dim,{μ,ν,α,β,γ,σ,ρ,τ,κ}]

?SpaceTime

?dim
(** We can also set the dimension to an specific value: DefManifold[SpaceTime,4,{μ,ν,α,β,γ,σ,ρ,τ,κ}] **)

Defining Scalars, Vectors and Tensors

In xAct, we can define scalars, vectors and tensors using the function ‘DefTensor’

?DefTensor

Defining a scalar in our manifold ' SpaceTime'

DefTensor[phi[],SpaceTime,PrintAs->"ϕ"]

phi[]

Defining vectors in our manifold ' SpaceTime'

DefTensor[V[-μ],SpaceTime,PrintAs->"V"]
DefTensor[U[μ],SpaceTime,PrintAs->"U"]
(** Note that V was defined as a covariant vector and U was defined as a contravariant vector **) 
(** The position of the index used in 'DefTensor' defines 'canonical form' os these objects. We will see consequences later**)

{V[-μ],U[μ]}

Defining rank-2 tensors in our manifold ‘SpaceTime’

DefTensor[T[-μ,-ν],SpaceTime,PrintAs->"T"] (** no symmetry property **)
DefTensor[h[-μ,-ν],SpaceTime,Symmetric[{-μ,-ν}],PrintAs->"h"] 
DefTensor[F[-μ,-ν],SpaceTime,Antisymmetric[{-μ,-ν}],PrintAs->"F"]

{T[-μ,-ν],h[-μ,-ν],F[-μ,-ν]}

We can also introduce label indices ‘LI’ to tensors

DefTensor[W[-LI["lb"],-μ,-ν],SpaceTime,PrintAs->"W"]

{W[-LI["lb"],-μ,-ν],W[-LI[1],-μ,-ν],W[-LI[2],-μ,-ν],W[-LI["anything"],-μ,-ν]}

How about the option ‘PrintAs’ in ‘DefTensor’?

?PrintAs

PrintAs[phi]

PrintAs[phi]^="test"

phi[]

PrintAs[phi]^="ϕ"

phi[]

Defining Constant Symbols

xAct functions requires that all symbols in a given expression were previously defined.

If we try to apply xAct function in expressions containing undefined symbols, we get errors

a h[-μ,-ν]+b h[-μ,-ν]//ToCanonical (** We will see 'ToCanonical' in the next section **)

To avoid this problem, we can define constant symbols:

?DefConstantSymbol

DefConstantSymbol[a]
DefConstantSymbol[b]

?a

DefConstantSymbol[a1,PrintAs->"(Subscript[a, 1])"]

a1

a h[-μ,-ν]+b h[-μ,-ν]//ToCanonical

To define several constant symbols (with a similar pattern) at once, we can use ‘DefNiceConstantSymbol’

?DefNiceConstantSymbol

DefNiceConstantSymbol["c",#]&/@Range[4] (** This will define the constant symbols c1, c2, c3 and c4 **)

{c1,c2,c3,c4}

Simplifying functions

xAct has several powerful simplifying functions, e.g.: ‘ToCanonical’, ‘Simplification’, ‘CollectTensors’, ‘CollectConstants’

?ToCanonical

?Simplification

?CollectTensors

?CollectConstants

ToCanonical

‘ToCanonical’ is one of the most powerful functions of xAct.
The purpose of ‘ToCanonical’ is to bring all terms in a given expression to its ‘canonical form’. Let’s explore this idea with some examples:

Applying ToCanonical symmetric tensors

h[-μ,-ν] -h[-ν,-μ]//Simplify

h[-μ,-ν] //ToCanonical (** Already in the 'canonical form' -> nothing happens! **)

h[-ν,-μ] //ToCanonical (** Not in the 'canonical form' -> it changes the order of indices! **)

Simplifying expressions using ToCanonical

h[-μ,-ν] -h[-ν,-μ]//ToCanonical

h[-μ,-ν] +h[-ν,-μ]//ToCanonical

Applying ToCanonical anti - symmetric tensors

F[-μ,-ν] //ToCanonical (** Already in the 'canonical form' -> nothing happens! **)

F[-ν,-μ] //ToCanonical (** Not in the 'canonical form' -> it changes the order of indices! **)

Simplifying expressions using ToCanonical

F[-μ,-ν] -F[-ν,-μ]//ToCanonical

F[-μ,-ν] +F[-ν,-μ]//ToCanonical

Contraction of symmetric and anti-symmetric tensors

h[μ,ν]F[-μ,-ν]

h[μ,ν]F[-μ,-ν]//ToCanonical

U[μ]U[ν]F[-μ,-ν]

U[μ]U[ν]F[-μ,-ν]//ToCanonical

‘ToCanonical’ also account to index relabelling

U[μ]V[-μ]-U[α]V[-α]
%//Simplify

U[μ]V[-μ]-U[α]V[-α]//ToCanonical

xAct also includes a ‘ReplaceDummies’ function, which performs the replacement of dummy indices. This is useful to avoid “index collision”.

ReplaceDummies[U[μ]V[-μ]]
%//InputForm

CollectTensors

‘CollectTensors’ combines ‘ToCanonical’ with ‘ContractMetric’ (which will make sense once defined a metric), but also collects the expression in terms of the different tensors structures that appears in the expression.

c1 h[μ,ν]+c2 h[ν,μ]+c3 F[μ,ν]+c4 F[ν,μ]

c1 h[μ,ν]+c2 h[ν,μ]+c3 F[μ,ν]+c4 F[ν,μ]//ToCanonical

c1 h[μ,ν]+c2 h[ν,μ]+c3 F[μ,ν]+c4 F[ν,μ]//CollectTensors

By default, ‘CollectTensors’ applies ‘Simplify’ each of the coefficient in the result expression

((Cos[a])^2) h[μ,ν]+((Sin[a])^2) h[ν,μ]+c3 F[μ,ν]+c4 F[ν,μ]//CollectTensors

but we can change the simplification method (it can save some time if we apply this function to large expressions)

((Cos[a])^2) h[μ,ν]+((Sin[a])^2) h[ν,μ]+c3 F[μ,ν]+c4 F[ν,μ]//CollectTensors[#,SimplifyMethod->Identity]&

‘CollectTensors’ allow us to track its progress by changing the ‘Verbose’ option (the default is ‘False’)

((Cos[a])^2) h[μ,ν]+((Sin[a])^2) h[ν,μ]+c3 F[μ,ν]+c4 F[ν,μ]//CollectTensors[#,Verbose->True]&

Defining a Metric, Covariant Derivatives and Geometrical Objects

Metric and Covariant Derivative

We can define a metric associated with our manifold ‘SpaceTime’. At the same time, we define a covariant derivative compatible with such metric

?DefMetric

DefMetric[-1, metric[-μ,-ν],CD,{";","∇"},PrintAs->"g"]
(** '-1' defines a Lorentzian metric **)
(** We can also use '+1' to define an Euclidean metric -- mostly used in AS/FRG calculations **)

?metric

?CD

CD is a covariant derivative compatible with ‘metric’

CD[μ]@metric[-μ,-ν]

Two upper indices define the inverse metric

metric[α,μ]metric[-μ,-ν]

Mixed indices collapse to a Kronecker delta

metric[μ,-ν]

xAct also have a pre-define Kronecker delta

delta[μ,-ν]

xAct has a pre-define ‘ordinary derivative’: PD
In general, PD is not compatible with the metric

PD[μ]@metric[-μ,-ν]

Once we define a metric, xAct automatically introduce a ‘metric determinant’ and a Levi-Civita tensorial-density:

?Detmetric

Detmetric[]

?epsilonmetric

epsilonmetric[μ,ν,α,β]

Geometrical objects

The definition of a metric with a covariant derivative automatically defines several geometrical objects  associated with it.

ChristoffelCD[μ,-ν,-β]

%//ChristoffelToMetric

(** By default,there is no torsion associated with CD (this can be changed!) **)
TorsionCD[μ,ν,α]

RiemannCD[-μ,-ν,-α,β]

%//RiemannToChristoffel

RiemannCD[-μ,-ν,-α,-β]+RiemannCD[-μ,-ν,-β,-α]
%//ToCanonical

RiemannCD[-μ,-ν,-α,-β]+RiemannCD[-ν,-μ,-α,-β]
%//ToCanonical

RiemannCD[-μ,-ν,-α,-β]-RiemannCD[-α,-β,-μ,-ν]
%//ToCanonical

RicciCD[-μ,-ν]

%-RiemannCD[α,-μ,-α,-ν]

RicciCD[-μ,-ν]-RicciCD[-ν,-μ]
%//ToCanonical

RicciScalarCD[]

%-RicciCD[μ,-μ]

EinsteinCD[-μ,-ν]

%//EinsteinToRicci

CD[μ]@EinsteinCD[-μ,-ν]

TFRicciCD[-μ,-ν]

{TFRicciCD[μ,-μ],metric[μ,ν]TFRicciCD[-μ,-ν]}

TFRicciCD[-μ,-ν]//TFRicciToRicci

%//RicciToTFRicci//CollectTensors

WeylCD[-μ,-ν,-α,-β]

{WeylCD[-μ,μ,-α,-β],WeylCD[-μ,-ν,μ,-β],WeylCD[-μ,-ν,-α,μ]}//CollectTensors

WeylCD[-μ,-ν,-α,-β]//WeylToRiemann

%//RiemannToWeyl//CollectTensors

EulerDensity[CD]

EulerDensity[CD,4]

Extra covariant derivatives

We can also define extra covariant derivatives (they also introduce additional geometrical objects):

?DefCovD

DefCovD[CDnew0[-μ],{":","(Subscript[𝒟, 0])"}] (** not compatible with 'metric'; no torsion **)

CDnew0[-μ]@metric[μ,ν]

ChristoffelCDnew0[μ,-ν,-β]-ChristoffelCDnew0[μ,-β,-ν]//ToCanonical

DefCovD[CDnew1[-μ],{FromMetric->metric},{":","(Subscript[𝒟, 1])"}] (** compatible with 'metric'; no torsion **)

CDnew1[-μ]@metric[μ,ν]

ChristoffelCDnew1[μ,-ν,-β]-ChristoffelCDnew1[μ,-β,-ν]//ToCanonical

DefCovD[CDnew2[-μ],{FromMetric->metric,Torsion->True},{":","(Subscript[𝒟, 2])"}] (** compatible with 'metric'; with torsion **)

CDnew2[-μ]@metric[ν,α]

ChristoffelCDnew2[μ,-ν,-β]-ChristoffelCDnew2[μ,-β,-ν]//ToCanonical

DefCovD[CDnew3[-μ],{Torsion->True},{":","(Subscript[𝒟, 3])"}] (** not compatible with 'metric'; with torsion **)

CDnew3[-μ]@metric[ν,α]

ChristoffelCDnew3[μ,-ν,-β]-ChristoffelCDnew3[μ,-β,-ν]//ToCanonical

RiemannCDnew3[-μ,-ν,-α,-β]+RiemannCDnew3[-ν,-μ,-α,-β]//ToCanonical

RiemannCDnew3[-μ,-ν,-α,-β]+RiemannCDnew3[-μ,-ν,-β,-α]//ToCanonical

RicciCDnew3[-μ,-ν]-RicciCDnew3[-ν,-μ]//ToCanonical

Scalar Functions

xAct also allow us to define Scalar Functions. 
Note that ‘Scalar Functions’ are not the same as the scalars defined with DefTensor

?DefScalarFunction

DefScalarFunction[f]

{f[phi[]],f[V[μ]V[-μ]],f[RicciScalarCD[]]}

If we take derivatives of Scalar Functions, it will automatically apply the chain rule

CD[μ]@f[phi[]]

CD[α]@f[V[μ]V[-μ]]

CD[μ]@f[RicciScalarCD[]]

Scalar Functions also admit several arguments

f[phi[],RicciScalarCD[],V[μ]V[-μ]]

CD[ν]@f[phi[],RicciScalarCD[],V[μ]V[-μ]]

Vector Bundle

?DefVBundle

DefConstantSymbol[𝒩];
DefVBundle[SUNfund,SpaceTime,𝒩,{c,d,e}]
DefVBundle[SUNadj,SpaceTime,(𝒩^2)-1,{i,j,k,l,m,n}]

DefTensor[A[-μ,-c],SpaceTime]
DefTensor[ϕ[-i],SpaceTime]

Indices manipulations

?FindIndices

A[μ,i]A[-μ,-i]//FindIndices

?FindFreeIndices

A[μ,i]A[-μ,-i]//FindFreeIndices

A[μ,i]A[-μ,-i]V[ν]//FindFreeIndices

A[μ,i]A[-μ,-i]V[ν]W[-LI["lb"],-α,-β]//FindFreeIndices

?ScreenDollarIndices

A[μ,i]A[-μ,-i]//ReplaceDummies//InputForm

A[μ,i]A[-μ,-i]//ReplaceDummies//ScreenDollarIndices//InputForm

?DummyIn

{DummyIn[TangentSpaceTime],DummyIn[SUNfund],DummyIn[SUNadj]}

?SlotsOfTensor

SlotsOfTensor[A]

SlotsOfTensor[W]

Other useful functions and objects

?MakeRule

CD[-μ]@h[μ,ν]/.{CD[-α_]@h[α_,β_]:>V[β]}

CD[μ]@h[-μ,ν]/.{CD[-α_]@h[α_,β_]:>V[β]}

CD[-μ]@h[ν,μ]/.{CD[-α_]@h[α_,β_]:>V[β]}

MakeRule[{CD[-α]@h[α,β],V[β]}]

{CD[-μ]@h[μ,ν],CD[μ]@h[-μ,ν],CD[-μ]@h[ν,μ]}/.MakeRule[{CD[-α]@h[α,β],V[β]}]

?InertHead

DefInertHead[FInert,PrintAs->"F"]

FInert[h[μ,ν]]-FInert[h[ν,μ]]//CollectTensors

FInert[RiemannCD[-μ,-ν,-α,-β]]+FInert[RiemannCD[-μ,-ν,-β,-α]]//CollectTensors

?SolveConstants

DefNiceConstantSymbol["c",#]&/@Range[3]

c2 RicciCD[-μ,-ν]+c3 RicciCD[-ν,-μ]
SolveConstants[%==0,c2]

2 c1 RicciCD[α,β]RicciCD[-α,-β]+c2 RicciCD[-μ,-ν]RicciCD[μ,ν]+c2 RicciScalarCD[]-c3 RicciScalarCD[]
SolveConstants[%==0,{c1,c2}]

Further simplification involving the Riemann tensor

?CurvatureRelationsBianchi

CD[-α]@RiemannCD[-β,-μ,-ν,α]
%/.CurvatureRelationsBianchi[CD]

CD[-α]@RicciCD[-β,α]
%/.CurvatureRelationsBianchi[CD]

CurvatureRelationsBianchi[CD]

?RiemannYoungProject

RiemannCD[-μ,-ν,-α,-β]//RiemannYoungProject

Equations of Motion

Quit (** To reinitialize the Kernel **)

Loading xTras

Block[{Print},<<xAct`xTras`]

$DefInfoQ=False;
$UndefInfoQ=False;
(** We can use this setting to avoid all the text generated by xAct DefXXXX **)

Defining a Manifold, Metric and Covariant Derivative

DefManifold[SpaceTime,dim,{μ,ν,α,β,γ,σ,ρ,τ,κ}]

DefMetric[-1, metric[-μ,-ν],CD,{";","∇"},PrintAs->"g"]

EOM in General Relativity

DefConstantSymbol[Λ]
DefConstantSymbol[G]
(** We will use these symbols as coupling constants **)

ℒEH = (1/(16π G)) (2 Λ -RicciScalarCD[]) ; (** Einstein-Hilbert Lagrangian **)
SEH=(Sqrt[-Detmetric[]])ℒEH; (** Einstein-Hilbert Action **)

xAct (in particular xTras) has a function corresponding to functional derivatives

?VarD

VarD[metric[μ,ν],CD][SEH] (** This is the functional derivative of SEH w.r.t. the inverse metric **)

VarD[metric[μ,ν],CD][SEH]//RicciToEinstein//CollectTensors (** rewrinting in terms of the Einstein tensor **)

(((-16π G))/(Sqrt[-Detmetric[]]))VarD[metric[μ,ν],CD][SEH]//RicciToEinstein//CollectTensors (** standard form of the l.h.s. of the vacuum Einstein's equation **)

We can also use the function VarL, that automatically includes (Sqrt[-g]) factors

?VarL

(** Note that we are using this function in ℒEH instead of SEH **)
(-16π G)×VarL[metric[μ,ν],CD][ℒEH]//RicciToEinstein//CollectTensors

EOM in General Relativity + Minimally coupled scalars

DefTensor[ϕ[],SpaceTime]
(** Used as a scalar field **)

DefConstantSymbol[mϕ2]
(** Scalar mass parameter **)

ℒϕ=(1/2)metric[μ,ν]CD[-μ]@ϕ[]CD[-ν]@ϕ[]-(1/2)mϕ2 ((ϕ[])^2) ; 
Sϕ=(Sqrt[-Detmetric[]])ℒϕ;

(** Using VarD **)
(((-16π G))/(Sqrt[-Detmetric[]]))VarD[metric[μ,ν],CD][SEH+Sϕ]//RicciToEinstein//CollectTensors

(** Using VarL **)
(-16π G)× VarL[metric[μ,ν],CD][ℒEH+ℒϕ]//RicciToEinstein//CollectTensors

Checking the result:

(** Scalar field energy momentum tensor: **)
Tϕ[μ_,ν_]:=CD[μ]@ϕ[]CD[ν]@ϕ[]-metric[μ,ν]ReplaceDummies[ℒϕ]

EinsteinCD[-μ,-ν]+Λ metric[-μ,-ν]-8π G Tϕ[-μ,-ν]//CollectTensors

Beyond General Relativity: Quadratic Gravity

DefConstantSymbol[{a,b,c}]

ℒHD = (1/(16π G)) (2 Λ -RicciScalarCD[] + (a/4)((RicciScalarCD[])^2) + (b/4)RicciCD[-μ,-ν] RicciCD[μ,ν] +  (c/4)RiemannCD[-μ,-ν,-α,-β] RiemannCD[μ,ν,α,β])  ;

-16π G × VarL[metric[μ,ν]][ℒHD]//CollectTensors

Beyond General Relativity: f(R) Gravity

DefScalarFunction[f]

ℒfR = (1/(16π G))f[RicciScalarCD[]]  ;

-16π G × VarL[metric[μ,ν]][ℒfR]//CollectTensors

Metric Perturbations

Quit (** To reinitialize the Kernel **)

Loading xTras

Block[{Print},<<xAct`xTras`]

$DefInfoQ=False;
$UndefInfoQ=False;
(** We can use this setting to avoid all the text generated by xAct DefXXXX **)

Defining a Manifold, Metric and Covariant Derivative

DefManifold[SpaceTime,dim,{μ,ν,α,β,γ,σ,ρ,τ,κ}]

DefMetric[-1, metric[-μ,-ν],CD,{";","∇"},PrintAs->"g"]

Defining Metric Fluctuations

Defining metric general fluctuations

?DefMetricPerturbation

DefMetricPerturbation[metric,metricpert,δϵ,PrintAs->"δg"]
ConstantQ[δϵ]^=True;
(** The constant parameter δϵ is used as a counter parameter to track the expansion in metric fluctuations **)

{metricpert[LI[0],μ,ν],metricpert[LI[1],μ,ν],metricpert[LI[2],μ,ν],metricpert[LI[3],μ,ν]}
%//InputForm

Let us also define a metric fluctuation tensor

DefTensor[h[-μ,-ν],SpaceTime,Symmetric[{-μ,-ν}],PrintAs->"h"]

We can relate different orders of metric perturbations with the fluctuation tensor for specific parameterization

(** (Subscript[g, μν])=(Subscript[(OverBar[g]), μν])+(Subscript[h, μν]) **)
FluctLinearParam[expr_]:=expr/.{metricpert[LI[1],μ_,ν_]:>h[μ,ν],metricpert[LI[n_],μ_,ν_]/;n>1:>0}

(** (Subscript[g, μν])=(Subscript[(OverBar[g]), μα])(Subscript[((e^h)),   ν]^α) **)
FluctExpParam[expr_]:=expr/.{metricpert[LI[1],μ_,ν_]:>h[μ,ν],metricpert[LI[2],μ_,ν_]:>Module[{α},h[μ,α]h[-α,ν]],metricpert[LI[n_],μ_,ν_]/;n>2:>0}
 (** up to second order - it is possible to generalize! **)

‘Perturbation’, ‘Perturbed’ and ‘ExpandPerturbation’

The function ‘Perturbation’ defines the metric perturbation in a given order in δϵ.

?Perturbation

Perturbation[metric[-μ,-ν],0]

Perturbation[metric[-μ,-ν],1]

Perturbation[metric[-μ,-ν],2]

Metric perturbations in specific parameterization :

{Perturbation[metric[-μ,-ν],0],Perturbation[metric[-μ,-ν],1],Perturbation[metric[-μ,-ν],2]}
%//FluctLinearParam

{Perturbation[metric[-μ,-ν],0],Perturbation[metric[-μ,-ν],1],Perturbation[metric[-μ,-ν],2]}
%//FluctExpParam

Let’s see the effect of ‘Perturbation’ when applied to other objects:

Perturbation[metric[μ,ν],0]

Perturbation[metric[μ,ν],1]

Perturbation[metric[μ,ν],2]

To obtain the explicit result, we need to apply ‘ExpandPerturbation’

Perturbation[metric[μ,ν],1]//ExpandPerturbation

Perturbation[metric[μ,ν],2]//ExpandPerturbation

Perturbation[Detmetric[],0]

Perturbation[Detmetric[],1]
%//ExpandPerturbation

Perturbation[Detmetric[],2]
%//ExpandPerturbation

Perturbation[RiemannCD[-μ,-ν,-α,-β],0]

Perturbation[RiemannCD[-μ,-ν,-α,-β],1]
%//ExpandPerturbation

Perturbation[RiemannCD[-μ,-ν,-α,-β],2]
%//ExpandPerturbation

The function ‘Perturbed’ will give metric perturbations up to a given order

?Perturbed

Perturbed[metric[-μ,-ν],4] (** Note the 1/n! factors **)

Perturbed[metric[μ,ν],4]
%//ExpandPerturbation

Perturbed[Detmetric[],2]
%//ExpandPerturbation

Perturbed[RiemannCD[-μ,-ν,-α,-β],2]
%//ExpandPerturbation

Consistency check of metric perturbations

Perturbed[metric[μ,α],4]Perturbed[metric[-α,-ν],4]

%//ExpandPerturbation//CollectTensors//Collect[#,δϵ]&

Metric perturbations in General Relativity

DefConstantSymbol[Λ]
DefConstantSymbol[G]

SEH=((Sqrt[-Detmetric[]])/(16π G)) (2 Λ -RicciScalarCD[]);

First order perturbation

ExpandPerturbation@Perturbation[SEH,1]//CollectTensors

Second order perturbation

ExpandPerturbation@Perturbation[SEH,2]
%//CollectTensors

(** Note: red brackets -> Scalar[_]; This is introduced to avoid collision of dummy indices along the calculation **)
Scalar[h[μ,-μ]]

h[μ,-μ]h[-μ,μ](** this is wrong **)

Scalar[h[μ,-μ]]Scalar[h[-μ,μ]] (** this is safe **)

ExpandPerturbation@Perturbation[SEH,2]//CollectTensors//FluctLinearParam

ExpandPerturbation@Perturbation[SEH,2]//CollectTensors//FluctExpParam

Metric perturbations beyond General Relativity: Quadratic Gravity

DefConstantSymbol[{a,b,c}]

ℒHD = (1/(16π G)) (2 Λ -RicciScalarCD[] + (a/4)((RicciScalarCD[])^2) + (b/4)RicciCD[-μ,-ν] RicciCD[μ,ν] +  (c/4)RiemannCD[-μ,-ν,-α,-β] RiemannCD[μ,ν,α,β])  ;
SHD=(Sqrt[-Detmetric[]]) ℒHD;

First order perturbation

ExpandPerturbation@Perturbation[SHD,1]//CollectTensors

Second order perturbation

ExpandPerturbation@Perturbation[SHD,2]//CollectTensors

Metric perturbations beyond General Relativity: f(R)

DefScalarFunction[f]

ℒfR = (1/(16π G))f[RicciScalarCD[]]  ;
SfR=(Sqrt[-Detmetric[]]) ℒfR;

First order perturbation

ExpandPerturbation@Perturbation[SfR,1]//CollectTensors

Second order perturbation

ExpandPerturbation@Perturbation[SfR,2]//CollectTensors

Metric perturbations in the matter sector

DefTensor[ϕ[],SpaceTime]
(** Used as a scalar field **)

DefConstantSymbol[mϕ2]
(** Scalar mass parameter **)

ℒϕ=(1/2)metric[μ,ν]CD[-μ]@ϕ[]CD[-ν]@ϕ[]-(1/2)mϕ2 ((ϕ[])^2) ; 
Sϕ=(Sqrt[-Detmetric[]])ℒϕ;

ExpandPerturbation@Perturbation[Sϕ,1]//CollectTensors

ExpandPerturbation@Perturbation[Sϕ,2]//CollectTensors

We also need to specify fluctuations of the “matter fields”.

DefTensorPerturbation[ϕpert[LI["order"]],ϕ[],SpaceTime,PrintAs->"(Subscript[ϕ, pert])"]

ExpandPerturbation@Perturbation[Sϕ,1]//CollectTensors

ExpandPerturbation@Perturbation[Sϕ,2]//CollectTensors

Let us consider only linear perturbations .

DefTensor[δϕ[],SpaceTime]

Fluctϕ[expr_]:=expr/.{ϕpert[LI[n_]]:>If[n===1,δϕ[],0]}

ExpandPerturbation@Perturbation[Sϕ,1]//CollectTensors//Fluctϕ

ExpandPerturbation@Perturbation[Sϕ,2]//CollectTensors//Fluctϕ

Sorting Covariant Derivatives

Quit

Loading xTras + Geometrical Objects

Block[{Print},<<xAct`xTras`]

$DefInfoQ=False;
$UndefInfoQ=False;

DefManifold[SpaceTime,dim,{μ,ν,α,β,γ,σ,ρ,τ,κ}]
DefMetric[-1, metric[-μ,-ν],CD,{";","∇"},PrintAs->"g",SymCovDQ->True]

SortCovDs and all that

Here we will explore some functions that enforces the commutation of covariant derivative. These functions will be crucial for quantum gravity calculations based on the background field method.

Let us start defining a scalar, a vector and a tensor

DefTensor[S[],SpaceTime];
DefTensor[V[-μ],SpaceTime];
DefTensor[T[-μ,-ν],SpaceTime];

SortCovDs

?SortCovDs

SortCovDs on scalars

CD[-μ]@CD[-ν]@S[]//SortCovDs

CD[-ν]@CD[-μ]@S[]//SortCovDs

SortCovDs on vectors

CD[-μ]@CD[-ν]@V[-α]//SortCovDs

CD[-ν]@CD[-μ]@V[-α]//SortCovDs

SortCovDs on tensors

CD[-μ]@CD[-ν]@T[-α,-β]//SortCovDs

CD[-ν]@CD[-μ]@T[-α,-β]//SortCovDs

It also works for more than two covariant derivatives acting on  a give object

CD[-μ]@CD[-ν]@CD[-ρ]@S[]//SortCovDs

CD[-μ]@CD[-ν]@CD[-ρ]@CD[-τ]@S[]//SortCovDs

SortCovDsToBox and SortCovDsToDiv

When the tensorial structure allows, we can sort covariant derivatives such that we group them into Laplacians or Divergencies.
This will be very useful to perform simplifications in calculations based on the TT-decomposition (or York-decomposition).

?SortCovDsToBox

CD[-μ]@CD[-ν]@CD[μ]@V[-α]//SortCovDsToBox[V]

?SortCovDsToDiv

CD[α]@CD[-μ]@V[-α]//SortCovDsToDiv[V]

Symmetrized CovDs

?SymmetrizeCovDs

CD[-μ]@CD[-ν]@V[α]
%//SymmetrizeCovDs

?ExpandSymCovDs

CD[-μ,-ν]@V[α]//ExpandSymCovDs

Other tools for FRG/ASQG calculations

DoFun

Quit

Extracting beta functions from vertex expansion: (Subscript[β, (Subscript[g, n])])~ (∂_t)(Γ^((n))) ~Sum FRG diagrams

-> The package DoFun automatizes the generation of FRG diagrams for n-point correlation functions (also useful for Dyson-Schwinger equations)
-> We can install DoFun by running the following command on Mathematica: 
	Import[“https://raw.githubusercontent.com/markusqh/DoFun/master/DoFun/DoFunInstaller.m”]

(*Import["https://raw.githubusercontent.com/markusqh/DoFun/master/DoFun/DoFunInstaller.m"]*)

(* Loading DoFun *)
<<DoFun`

Example NJL + Gravity

?setFields

setFields[{h},{{ψ,ψb}},{}]

(** Defining an schematic truncation **)
Γk = {{h,h},{h,h,h},{h,h,h,h},{ψb,ψ},{h,ψb,ψ},{h,h,ψb,ψ},{ψb,ψ,ψb,ψ},{h,ψb,ψ,ψb,ψ},{h,h,ψb,ψ,ψb,ψ}};

Flow4Ferm=doRGE[Γk,{ψ,ψ,ψb,ψb}]

RGEPlot[Flow4Ferm,{{h,Black},{ψ,Blue}}]

-> You can also convert schematic DoFun outputs into algebraic expression (combine with vertices and propagators derived with xAct)

FormTracer

Quit

-> Depending on how large are the computations you are interested in, Mathematica/xAct hits a threshold in terms of efficiency.
-> Highly efficient tensor contractions with FORM
-> FormTracer = “User friendly Mathematica interface” + “High Performance of FORM”
-> Easily integrated with other Mathematica tools (e.g., xAct)

-> We can install FormTracer by running the following command on Mathematica:
	Import[“https://raw.githubusercontent.com/FormTracer/FormTracer/master/src/FormTracerInstaller.m”]

(*Import["https://raw.githubusercontent.com/FormTracer/FormTracer/master/src/FormTracerInstaller.m"]*)

(* Loading FormTracer *)
<<FormTracer`

DefineLorentzTensors[deltaLorentz[μ,ν],vec[p,μ],sp[p,q],eps[],deltaDirac[i,j],gamma[μ,i,j],gamma5[i,j]];

Very efficient for fully contracted expressions

test1a=Plus@@Times@@@Map[deltaLorentz@@#&,Map[Partition[#,2]&,Permutations[{μ,ν,α,β,γ,σ,ρ,τ}]],{2}];
test1b=Plus@@Times@@@Map[deltaLorentz@@#&,Map[Partition[#,2]&,Permutations[{μ,ν,α,β,γ,σ,ρ,τ}][[1;;50]]],{2}];

AbsoluteTiming[FormTrace[test1a×test1b]]

Block[{Print},<<xAct`xTras`]
$DefInfoQ=False;$UndefInfoQ=False;
DefManifold[SpaceTime,4,{μ,ν,α,β,γ,σ,ρ,τ,κ}]
DefMetric[-1, metric[-μ,-ν],CD,{";","∇"},PrintAs->"g",SymCovDQ->True]

test2a=Plus@@Times@@@Map[metric@@#&,Map[Partition[#,2]&,Permutations[{μ,ν,α,β,γ,σ,ρ,τ}]],{2}];
test2b=Plus@@Times@@@Map[metric@@#&,Map[Partition[#,2]&,Permutations[{-μ,-ν,-α,-β,-γ,-σ,-ρ,-τ}][[1;;50]]],{2}];

AbsoluteTiming[ContractMetric[test2a×test2b]]