xAct
 C: "Advanced" concepts

José M. Martín-García
	LUTH & IAP, France

LUTH & IAP, 21-29 April 2009

0. Read xTensor

<<xAct`xTensor`

Setup :

$PrePrint=ScreenDollarIndices;

Declare a manifold

DefManifold[M,4,IndexRange[a,q]]

and a metric field

DefMetric[-1,metric[-a,-b],CD,SymbolOfCovD->{";","D"},PrintAs->"g"]

1. Symmetrization

Create new tensor:

DefTensor[A[-a,-b,-c],M,Antisymmetric[{1,2,3}]]

Impose symmetries:

ImposeSymmetry[A[-a,-b,-c],{-a,-b},Symmetric[{1,2}]]

%//ToCanonical

ImposeSymmetry[A[-a,-b,-c],{-a,-b},Antisymmetric[{1,2}]]//ToCanonical

ImposeSymmetry[A[-a,-b,-c]A[-d,-e,-f],{-a,-d,-b,-f},RiemannSymmetric[{1,2,3,4}]]//ToCanonical

Particular examples:

Symmetrize[A[-a,-b,-c]A[-d,-e,-f],{-a,-d}]//ToCanonical

Symmetrize[A[-a,-b,-c]A[-d,-e,-f],{-e,-d}]//ToCanonical

Antisymmetrize[A[-a,-b,-c]A[-d,-e,-f],{-a,-d}]//ToCanonical

Antisymmetrize[A[-a,-b,-c]A[-d,-e,-f],{-e,-d}]//ToCanonical

1b. Symmetric TraceFree Part

This is the STF part of a 3-index tensor without symmetry, and with respect to the metric:

DefTensor[T[a,b,c],M]

STFPart[T[a,b,c],metric]

The result is not simplified at all. We must ask for explicit metric contraction and simplification:

%//ContractMetric//Simplification

% metric[-a,-c]//ContractMetric

%//ToCanonical

2. Mapping at specified positions

This makes use of the package ExpressionManipulation,written by David J. M. Park and Ted Ersek.

<<xAct/ExpressionManipulation.m

Suppose we have an expression like this, which is clearly 0 because A is antisymmetric and S is symmetric:

DefTensor[S[a,b],M,Symmetric[{a,b}]]

DefTensor[F[a,b],M,Antisymmetric[{1,2}]]

DefTensor[v[a],M]

expr=A[a,b,c]v[-a]v[-b]v[-c]+A[a,b,c]v[-a]S[-b,-c]+F[-b,-c]v[b]v[c]-F[-d,-e]v[d]v[e]

Simplification[expr]

Each object in the expression can be identified in a tree-like form by its position. In this case there are four positions at level 1:

expr//ColorTerms

We can evaluate a given function at one or several positions:

MapAt[Simplification,expr,{2}]

MapAt[Simplification,expr,{{1},{2}}]

We can also localize a given pattern:

expr//ColorPositionsOfPattern[_A]

or map a function onto the occurrences of that pattern:

positions=Position[expr,_A]

MapAt[f,expr,positions]

3. LATEX

Construct a random big expression :

expr=CD[-g][CD[-a][CD[-b][T[a,b,c]T[-c,d,e]S[-e,-f]F[i,j]]v[f]]]

TexPrint[expr]

TexBreak[%,200]

Export["test.tex",%,"Text"]

4. Other fibers on the same manifold

Define complex inner vbundle:

DefVBundle[InnerC,M,2,{𝔄,𝔅,ℭ,𝔇,𝔈},Dagger->Complex]

?InnerC

?InnerC†

Define a complex tensor field and its conjugate on that vbundle:

DefTensor[X[a,𝔅],M,Dagger->Complex]

?X

?X†

PD[-a][ X[a,𝔅] ]

Dagger[%]

Declare a Hermitian tensor :

DefTensor[H[𝔄,𝔅†],M,Dagger->Hermitian]

H[𝔄,𝔅†]

Dagger[%]

4b. Inner connections (gauge theory)

$CovDs

DefCovD[ICD[-a],InnerC,SymbolOfCovD->{"#","D"}]

Change of derivative:

ICD[-a][ X[b,ℭ] ]

ChangeCovD[%]

%//InputForm

ICD[-a][ X†[b,ℭ†] ]

ChangeCovD[%]

Commutation of derivatives:

ICD[-a]@ICD[-b][ X[c,ℭ] ]

SortCovDs[%]

%//InputForm

ICD[-a]@ICD[-b][ X†[c,ℭ†] ]

SortCovDs[%]

5. ADM-type calculations

Construct a unit timelike vector :

DefTensor[u[a],M]

u/:u[a_]u[-a_]:=-1

u[-c]u[c]

Construct induced metric :

DefMetric[1,metrich[-a,-b],cd,SymbolOfCovD->{"|","𝔇"},InducedFrom->{metric,u},PrintAs->"h"]

Now we have new objects and properties:

metrich[-a,-b]

metrich[-a,b]

metrich[-a,-b]u[b]

CD[-a][u[-b]]

%//GradNormalToExtrinsicK

Sign conventions as in Wald :

{$ExtrinsicKSign,$AccelerationSign}

A standard computation :

DefTensor[w[a],M,OrthogonalTo->{u[-a]}]

CD[-d][CD[-c][w[-b]]]

expr1=ProjectWith[metrich][%]

expr2=cd[-d][cd[-c][w[-b]]]

expr1-expr2

%//ProjectDerivative

%//ProjectDerivative

%/.Projectormetrich->ProjectWith[metrich]

%//ProjectorToMetric//Expand

%//GradNormalToExtrinsicK//Expand

%//Simplification

Two useful commands :

RiemannCD[-a,-b,-c,d]

InducedDecomposition[%,{metrich,u}]

ToCanonical[%]

GaussCodazzi[RiemannCD[-a,-b,-c,d],metrich]

We can manipulate this expression to give it in other forms.

%/.Projectormetrich->ProjectWith[metrich]

ContractDir[%,u]

DirCovDToLieD[%,u]//Expand

6. Finding and replacing indices

The internal function for finding indices is called FindIndices, but users have IndicesOf :

IndicesOf[][expr]

Order of selectors is relevant :

IndicesOf[Free,Up][expr]

IndicesOf[Up,Free][expr]

To get indices of different terms do this :

Map[IndicesOf[Free],List@@expr]

There is an internal function to replace indices, called ReplaceIndex, but because this is something that users should never do, there is no friendly user counterpart (except for delta).

ReplaceIndex[LieD[v[a]][A[a,-a,c]],{a->-d}]

InputForm[%]

This is the proper way to change indices :

LieD[v[a]][A[a,-a,c]]delta[-c,d]

7. Package xPert

<<xAct/xPert.m

7b. The perturbative structure

Build perturbative structure

DefParameter[ϵ]

DefMetricPerturbation[metric,pert,ϵ]

PrintAs[pert]^="h";

Define the following function for simplification :

org[expr_]:=Collect[ContractMetric[expr],ϵ,ToCanonical]

This will color the perturbative order :

Unprotect[IndexForm];
IndexForm[LI[x_]]:=ColorString[ToString[x],Blue]
Protect[IndexForm];

7c. Perturbations of the metric

Perturbation[metric[-a,-b],5]

Perturbation[pert[LI[3],-a,-b],5]

Perturbations of the inverse metric

Perturbation[metric[a,b]]

%//ExpandPerturbation

Perturbation[metric[a,b]]Perturbation[metric[c,d],4]//ExpandPerturbation

Check:

Perturbed[metric[-a,-b],4]//org

Perturbed[metric[b,c],4]//ExpandPerturbation

% %%//org

7d. Perturbations of curvature tensors

Perturbation of Riemann :

Perturbation[RiemannCD[-a,-b,-c,d],6]//ExpandPerturbation

Expand[%]//Length

Perturbation of Einstein :

Perturbation[EinsteinCD[-a,-b]]//ExpandPerturbation//ToCanonical

UndefParameter[ϵ]

Let us have a look ...

8. The internals of the canonicalizer

Four notations for permutations. Suppose

♡	⌚	□	○	☺	△
is reordered to
	□	⌚	○	♡	△	☺

	Perm[{3, 2, 4, 1, 6, 5}]
	Images[{4, 2, 1, 3, 6, 5}]
	Cycles[{1, 4, 3}, {5, 6}]
	Rules[1->4, 4->3, 3->1, 5->6, 6->5]

Translation and (noncommutative!) product:

TranslatePerm[Perm[{3,2,4,1,6,5}],Cycles]

Permute[Perm[{3,2,1}],Perm[{2,3,1}]]

8b. (Strong) Generating sets

Setup :

SetOptions[{SchreierSims,Orbit},MathLink->True];

Let us suppose that we number from 1 to 48 the non-central coloured squares of a Rubik's cube. There are six basic rotations, corresponding to each of the six faces:

rot1=Cycles[{1,3,8,6},{2,5,7,4},{9,48,15,12},{10,47,16,13},{11,46,17,14}];
rot2=Cycles[{6,15,35,26},{7,22,34,19},{8,30,33,11},{12,14,29,27},{13,21,28,20}];
rot3=Cycles[{1,12,33,41},{4,20,36,44},{6,27,38,46},{9,11,26,24},{10,19,25,18}];
rot4=Cycles[{1,24,40,17},{2,18,39,23},{3,9,38,32},{41,43,48,46},{42,45,47,44}];
rot5=Cycles[{3,43,35,14},{5,45,37,21},{8,48,40,29},{15,17,32,30},{16,23,31,22}];
rot6=Cycles[{24,27,30,43},{25,28,31,42},{26,29,32,41},{33,35,40,38},{34,37,39,36}];
RubikGS=GenSet[rot1,rot2,rot3,rot4,rot5,rot6];

With a normal Linux box we can compute a strong generating set in a few seconds:

AbsoluteTiming[RubikSGS=SchreierSims[{},RubikGS];]

RubikSGS=TranslatePerm[RubikSGS,Cycles]

OrderOfGroup[RubikSGS]

FactorInteger[%]

Orders of the chain of stabilizers:

OrderOfGroup/@StabilizerChain[RubikSGS]

Drop[%/RotateLeft[%],-1]

Now we can check potential configurations:

Rotation of a corner or flip of an edge are forbidden:

PermMemberQ[Cycles[{8,15,14}],RubikSGS]

PermMemberQ[Cycles[{10,4}],RubikSGS]

But pairs of them are allowed, in adequate directions:

PermMemberQ[Cycles[{10,4},{7,13}],RubikSGS]

PermMemberQ[Cycles[{8,15,14},{24,41,38}],RubikSGS]

PermMemberQ[Cycles[{8,15,14},{24,38,41}],RubikSGS]

A combination of both is impossible:

PermMemberQ[Cycles[{10,4},{8,15,14}],RubikSGS]

(cont.)

This is the smallest of the three sporadic simple Conway groups, with a permutation representation of degree 276:

g1=Images[{245,42,112,15,131,7,188,75,132,10,11,187,186,265,22,159,256,43,101,123,134,4,32,209,238,35,45,235,126,5,19,60,66,80,154,251,117,206,71,118,93,87,167,271,221,261,182,155,47,230,172,236,109,191,76,156,73,116,147,23,127,231,38,53,122,210,24,68,86,255,196,139,149,21,111,203,252,72,262,114,214,9,181,174,85,95,2,250,257,243,90,158,170,148,69,105,249,263,16,54,31,115,51,104,125,219,92,46,64,204,8,266,225,34,175,145,161,180,237,241,224,169,269,12,96,129,189,190,29,17,30,82,143,74,168,13,227,217,78,258,220,178,228,146,58,254,273,215,57,106,77,110,50,26,248,260,274,107,99,253,37,25,272,44,52,119,18,201,65,41,233,103,246,200,102,160,198,207,157,40,223,49,267,79,1,136,124,6,61,268,100,70,98,171,121,39,62,211,208,84,135,97,55,152,141,63,142,259,67,33,177,173,14,242,94,113,240,264,150,205,27,183,83,195,216,163,247,133,36,153,197,140,194,120,270,165,166,162,218,138,234,81,91,89,185,212,137,48,202,276,229,151,176,144,192,130,244,232,199,56,108,184,193,239,213,3,222,128,20,28,164,226,59,179,275,88}];
g2=Images[{204,203,33,236,5,172,77,76,47,146,133,224,229,53,84,16,223,228,130,131,252,190,13,263,242,10,32,196,199,65,246,209,40,99,241,198,269,251,75,118,176,271,183,116,197,238,22,29,178,26,174,129,2,153,272,257,41,12,59,20,27,175,106,159,218,259,137,258,261,164,262,189,45,177,260,85,25,15,226,96,24,1,274,148,264,132,48,117,36,60,171,201,101,253,95,120,142,213,165,51,115,44,103,167,243,66,141,108,88,97,276,30,139,222,166,173,231,3,73,239,56,170,82,162,163,207,145,128,52,104,90,216,220,155,74,237,28,4,113,273,230,270,248,180,206,50,250,78,127,150,54,232,217,121,69,156,6,125,210,86,89,46,184,211,265,93,19,138,23,126,43,188,102,244,219,192,256,83,58,144,181,187,91,158,205,235,147,157,114,9,152,57,39,64,143,67,119,161,87,200,111,79,14,123,21,149,122,191,61,194,266,225,31,81,62,160,151,112,215,254,234,72,17,179,105,267,227,18,169,249,109,208,275,68,233,168,55,124,80,240,35,7,212,100,245,98,195,247,107,182,42,185,94,11,255,135,154,221,63,193,134,71,214,8,34,70,202,268,37,110,38,136,140,49,186,92}];

PermDeg/@{g1,g2}

AbsoluteTiming[Conway3SGS=SchreierSims[{},GenSet[g1,g2]];]

Length/@Conway3SGS

OrderOfGroup[Conway3SGS]

SetOptions[{SchreierSims,Orbit},MathLink->False];

5. Package Spinors

Load package :

<<xAct/Spinors.m

Create spin structure :
	g :    4d Lorentzian metric
	Spin :     complex 2d vbundle
	ϵ :     antisymmetric metric field
	σ :    soldering form
	cde :    spin connection, extension of the Levi-Civita connection of g

UndefTensor/@{A,H};

DefSpinStructure[metric,Spin,{A,B,C,D,H,L,P,Q},ϵ,σ,cde]

Separate and contract soldering forms :

RicciCD[a,b]//SeparateSolderingForm[]

%//ContractSolderingForm

Decompositions :

RiemannCD[-a,-b,-c,-d]//SeparateSolderingForm[]

%//Decomposition//Expand

Products of soldering forms :

σ[a,-A,-A†]σ[b,-B,A†]//ContractSolderingForm

%//InputForm

Sigmaσ[a,b,-A,-B]Sigmaσ[c,d,A,B]

%//ContractMetric

%/.TetraRule[metric]

Declare and manipulate spinors :

DefSpinor[ξ[C],M]

ξ[C]ξ[-C]

%//ToCanonical

ϵ[A,B]ξ[-B]

%//ContractMetric

ϵ[-A,-B]ξ[B]

%//ContractMetric

Spin - connections :

$CovDFormat="Prefix";

cde[-A,-B][ξ[C]ξ[D]]

DefSpinCovD[nb[-a],σ,SymbolOfCovD->{"@","D"}]

nb[-A,-B][ξ[C]ξ[D]]

nb[-A,-B][σ[a,-C,-C†]]