xAct`xTerior`

This is the doc file xTeriorDoc.nb of version 0.9.1 of xTerior`Last update on Date 28 of January of 2014.

Web:	http://www.xact.es/xTerior/
	 https://github.com/xAct-contrib/xTerior

© 2013-2019, under the GNU General Public License (GPL)
     Alfonso García-Parrado Gómez-Lobo
	Departamento de matemáticas
	Universidad de Córdoba, Spain
	agparrado@uco.es
     and
     Leo C. Stein
           U of MS, United States     
          leo.stein@gmail.com

xTerior` is the xAct` package for computations with (tensor valued) differential forms.

This loads the package from the default directory, for example $Home/.Mathematica/Applications/xAct/ for a single-user installation under Linux.

MemoryInUse[]

<<xAct`xTerior`

Comparing, we see that all packages take about 20 Mb in Mathematica  10.0:

MemoryInUse[]

(Out[3]-Out[1])/2^20//N

There are several contexts: xAct`xTerior`, xAct`xCoba`, xAct`xTensor`, xAct`xPerm` and xAct`xCore` contain the respective reserved words. System` contains Mathematica's reserved words. The current context Global` will contain your definitions and right now is empty (at least in Mathematica with version <10).

$ContextPath

Context[]

?Global`*

We turn off info messages issued by xAct def and undef commands.

$DefInfoQ=False;
$UndefInfoQ=False;

The user is assumed to be familiar with the standard tools of the exterior calculus. The wedge product and the exterior derivative only require a differentiable manifold to be defined. Other more advanced tools such as the Hodge dual and the co-differential require a pseudo-Riemannian metric on the manifold. The exterior covariant derivative is built upon a linear connection. In all the cases the required structures must be previously defined using commands of the packages automatically loaded when loading xTerior`. We refer the user to the documentation of each package for a description of the commands used in this session.

We define a differentiable manifold of symbolic dimension dim and introduce some differential forms on it.

DefConstantSymbol[dim, PrintAs->"D"]

DefManifold[M,dim,{a,b,c,d,e,f,g,h}]

DefDiffForm[A0[],M,0,PrintAs->"(A^0)"]

DefDiffForm[A1[],M,1,PrintAs->"(A^1)"]

DefDiffForm[A2[],M,2,PrintAs->"(A^2)"]

DefDiffForm[A3[],M,3,PrintAs->"(A^3)"]

The third argument of the command DefDiffForm specifies the degree or grade of the defined differential form. Differential forms are multiplied by means of the wedge product which is typed in with the key combination Esc ^ Esc. This corresponds to the Mathematica symbol without built-in meaning Wedge.

A1[]⋀A2[]

%//FullForm

A form of degree zero corresponds to a scalar field and thus the wedge product reduces to the standard Times product.

A0[]⋀A1[]⋀A2[]

%//FullForm

We can use the command Deg to check the degree of any expression containing differential forms. For example:

Deg@%

Deg/@{A2[]⋀A3[],A3[]⋀A3[]+A2[]⋀A2[]⋀A2[]}

We can add differential forms of different degrees but Deg throws an error when acting on these kind of expressions.

A2[]⋀A3[]+A3[]⋀A3[]+A2[]⋀A2[]⋀A2[]

Deg@%

The canonicalizer is prepared to work with expressions involving the wedge product. For example:

A1[]⋀A2[]+A2[]⋀A1[]

ToCanonical@%

A1[]⋀A1[]//ToCanonical

Other cases. Note the automatic sorting of factors.

A1[]⋀A2[]⋀A1[]//ToCanonical

A2[]⋀A1[]⋀A2[]//ToCanonical

A3[]⋀A2[]⋀A1[]⋀A2[]//ToCanonical

One can also define “tensor valued forms” with arbitrary symmetries.

DefDiffForm[ω1[a],M,1,PrintAs->"(^1)ω"]
DefDiffForm[ω2[a,b],M,2,Symmetric[{1,2}],PrintAs->"(^2)ω"]
DefDiffForm[ω3[a,b],M,3,PrintAs->"(^3)ω"]

Now we can canonicalize expressions involving tensor valued forms.

ω1[b]⋀ω1[a]//ToCanonical

The priority is to sort the forms (with less symmetric tensors first), not the indices :

ω3[a,b]⋀ω2[c,d]⋀ω1[e]//ToCanonical

The exterior derivative of a differential form is represented by Diff. The exterior derivative is a graded derivation and hence all the corresponding properties are implemented. Examples of simple computations.

Diff[A0[] ω1[a]]

Diff[ω1[a]⋀ω2[b,c]]

Diff[ω1[b]⋀ω1[a]]

%//ToCanonical

Diff[%]

%//ToCanonical

Something more involved.

Diff[A0[] ω1[a]⋀ω2[b,c]⋀ω3[d,e]]

%//ToCanonical

Diff[%]

%//ToCanonical

xTerior can handle automatically the fundamental (also called canonical) 1-form of the frame bundle of the manifold (see e.g. M. Spivak “A Comprehensive Introduction to Differential Geometry”, Vol. 2 p. 324 ) and its holonomic restriction. They are represented as follows:

{Coframe[M][a],dx[M][a]}

%//InputForm

Deg/@%%

The first element of the list is the generic canonical 1-form and the second element of the list is the holonomic canonical 1-form. One can operate with the canonical 1-form in the same way as with any other tensor valued differential form:

Coframe[M][b]⋀Coframe[M][a]//ToCanonical

Diff@%

%//ToCanonical

Diff@%

%//ToCanonical

Tensor valued forms and plain tensors can be mixed in the same expression and the symmetries of the complete expression are computed with no extra effort on the user side.

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

S[-a,-b]Coframe[M][a]⋀Coframe[M][b]

%//ToCanonical

Let us introduce now a covariant derivative in the manifold M.

DefCovD[CD[-a],{";","D"},Torsion->True]

When we define a covariant derivative and xTerior is loaded, a number of objects are automatically introduced in the session. These are the connection 1-form, the curvature 2-form and, if non-zero, the torsion 2-form:

{ConnectionForm[CD,TangentM][a,-b],CurvatureForm[CD,TangentM][a,-b],TorsionForm[CD][a]}

Given that we are working with a covariant derivative on the tangent bundle of a differentiable manifold, one has an equivalent representation for the connection and curvature forms, which is found next:

%//InputForm

Therefore, in this particular case, it is possible to use the Heads ConnectionForm, CurvatureForm or ChristoffelForm, RiemannForm. In fact we can modify the default output representation of these objects as follows:

PrintAs@ChristoffelForm[CD]^="γ";
PrintAs@RiemannForm[CD]^="ℛ";

Once a covariant derivative has been introduced, one can use the Cartan structure equations in the manipulations. This is achieved with the command UseCartan. For example :

Coframe[M][b]⋀Coframe[M][a]//Diff

UseCartan[%,CD]

Diff[%]

UseCartan[%,CD]

ToCanonical@%

We introduce a metric with full information about its signature. Its associated covariant derivative is automatically defined (note that we impose that the torsion of the Levi-Civita covariant derivative be non-zero). The information about the signature requires that we set a value for the dimension.

dim=4;

DefMetric[{1,3,0},metricg[-a,-b],CV,Torsion->True,PrintAs->"g"]

We change the options of ToCanonical to prevent indices inside the derivations from moving up and down.

SetOptions[ToCanonical,UseMetricOnVBundle->None];

Once we have a metric we have additional structures such as the Hodge dual and the co-differential. We illustrate both of them next:

Hodge[metricg][ω1[a]]

%//Deg

Hodge[metricg][%%]

Codiff[metricg][ω2[a,b]]

The co-differential can be transformed into its definition in terms of the exterior derivative by means of CodiffToDiff.

%//CodiffToDiff

Hodge duals of exterior powers of the fundamental 1-form can be worked out with ExpandHodgeDual.

Hodge[metricg][Coframe[M][a]⋀Coframe[M][b]⋀Coframe[M][c]]

ExpandHodgeDual[%,Coframe[M],metricg]

When we work with an explicit dimension then any expression whose degree is greater than the dimension vanishes. xTerior does not take this into account by default but we can change this by issuing the instruction UseDimensionStart. By doing this any expression whose degree is higher than the dimension will get replaced by zero.

A2[]⋀A2[]⋀A2[]//Deg

UseDimensionStart[]

A2[]⋀A2[]⋀A2[]

The exterior differential of a 4-form is identically zero in four dimensions.

A2[]⋀A2[]

Diff@%

We can define forms whose degree is higher than the dimension but they will automatically vanish.

DefDiffForm[A6[],M,6,PrintAs->"(A^6)"]

A6[]

Forms with degree greater than the dimension can be restored by issuing UseDimensionStop

UseDimensionStop[]

A6[]

We introduce now a coordinate chart in the manifold M.

DefChart[Sph,M,{0,1,2,3},{t[],r[],θ[],φ[]},FormatBasis->{"Partials","Differentials"},ChartColor->RGBColor[0,0,1]]

Once we have the coordinates, their differentials and their exterior products are computed with no difficulty. Example:

{Diff@t[],Diff@t[]⋀Diff@r[],Diff@θ[]⋀Diff@φ[]⋀Diff@t[]}

The components of the holonomic canonical 1-form are

{dx[M][{0,Sph}]->Diff@t[],dx[M][{1,Sph}]->Diff@r[],dx[M][{2,Sph}]->Diff@θ[],dx[M][{3,Sph}]->Diff@φ[]}

%/.Rule->ComponentValue;

We can now work with arbitrary differential forms defined in terms of these coordinates

A2[]==Sin[φ[]]/r[]Diff[r[]]⋀Diff@θ[]

Diff/@%

The result of this computation is by default neither canonicalized nor simplified. This has to be done by the user.

%//ToCanonical

Diff/@%

%//ToCanonical

It is also possible to work with differential forms involving arbitrary functions. For example:

DefScalarFunction[F]

F[t[],r[],θ[],φ[]]

Diff@%

Diff@%

ToCanonical@%

We undefine the structures introduced in this section.

UndefChart@Sph

UndefMetric@metricg

UndefCovD@CD

UndefDiffForm/@VisitorsOf@M;

UndefScalarFunction@F;

UndefManifold@M

We reset the value of the symbolic dimension and undefine it. We check that Global` contains no symbols.

dim=.

UndefConstantSymbol@dim

?Global`*

We define a differentiable manifold of symbolic dimension dim:

DefConstantSymbol@dim

DefManifold[M,dim,{a,b,c,d,e,f,g,h}]

Once we have a differentiable manifold, we can define differential forms on it. This is achieved with DefDiffForm which is a wrapper for the xTensor command DefTensor. The command DefDiffForm registers an object as a tensor valued differential form on a manifold. We can indicate the degree of the form as a separate argument. For example, let us define a 2-form on the manifold M.

DefDiffForm[Ω[],M,2]

The object Ω has been registered as a 2-form on M.

Deg@Ω[]

Once we have a differential form, we can start doing operations with it

Deg/@{Ω[]⋀Ω[],Ω[]⋀Ω[]⋀Ω[]}

We point out that Deg is a particular case of the more general xTensor command Grade:

Grade[Ω[]⋀Ω[],Wedge]

Another differential form and more examples of operations:

DefDiffForm[η[],M,4]

Ω[]⋀η[]+η[]⋀Ω[]

Expressions involving differential forms are canonicalized in the same way as any other expression in xAct.

ToCanonical@%

Now an example with a tensor valued form

DefDiffForm[τ[a],M,3]

Canonicalization proceeds without dificulty.

Ω[]⋀η[]⋀τ[a]+η[]⋀τ[a]⋀Ω[]

ToCanonical@%

As mentioned above, DefDiffForm is just a wrapper for DefTensor. This means that we can use DefTensor to introduce differential forms in our session:

DefTensor[L[a,-b],M,GradeOfTensor->{Wedge->2}]

$Tensors

τ[b]⋀L[a,-b]⋀Ω[]⋀η[]+τ[a]⋀η[]

ToCanonical@%

If we do not specify a grade with DefTensor then it is taken as zero by default and the object is regarded as a 0-form.

DefTensor[T[-a,-b],M,Symmetric[{-a,-b}]]

Deg@T[-a,-b]

One of the most important operations in the exterior calculus is the exterior derivative. This operation is implemented through the command Diff and it acts on any kind of differential form as we illustrate next:

τ[b]⋀L[a,-b]⋀Ω[]⋀η[]+τ[a]⋀η[]

Diff/@%

%//ToCanonical

We check that all the basic properties of the exterior derivative are implemented. For example the exterior derivative applied twice is zero identically (we may need to canonicalize the resulting expression to obtain this result).

Diff/@%

%//ToCanonical

It is possible to expand the exterior derivative in terms of partial derivatives (only when it acts on a zero degree form). Use UseCartan for that.

Diff[T[-a,-b]]

UseCartan[%,PD]

The symbol PD represents the fiducial covariant derivative in xTensor. We refer to section 6.1 of the documentation of xTensor for further information. In addition we point out that UseCartan has further applications which are explained in section 4.

First of all, we introduce a covariant derivative:

DefCovD[CD[-a],{";","D"},Torsion->True]

Once we have introduced a covariant derivative we can work with its connection 1-form and the curvature 2-form:

ChristoffelForm[CD][a,-b]

%//Deg

RiemannForm[CD][a,-b]

%//Deg

These elements are related by the Cartan structure equations. We can easily obtain the Cartan structure equations for a given connection by means of UseCartan.

CartanStructureEqs={Diff@Coframe[M][a]==UseCartan[Diff[Coframe[M][a]],CD],Diff@ChristoffelForm[CD][a,-b]==UseCartan[Diff[ChristoffelForm[CD][a,-b]],CD],Diff@TorsionForm[CD][a]==UseCartan[Diff[TorsionForm[CD][a]],CD],Diff@RiemannForm[CD][a,-b]==UseCartan[Diff[RiemannForm[CD][a,-b]],CD]}

We can also check the complete integrability conditions of the Cartan system.

Diff@%

UseCartan[%,CD]

ToCanonical[%]

Some of the Cartan equations can be formulated in any vector bundle. For example take a real vector bundle over the manifold M with 3-dimensional fibres and define a covariant derivative on it.

DefVBundle[VB,M,3,{A,B,C,D,J,H}]

DefCovD[cdv[-a],VB,{"|","𝒟"}]

For a covariant derivative defined in a general vector bundle, the notation for the connection 1-form and the curvature 2-form is slightly different; in addition to the symbol of the covariant derivative it also contains the symbol representing the vector bundle upon which the covariant derivative is defined.

ConnectionForm[cdv,VB][A,-B]

%//Deg

CurvatureForm[cdv,VB][A,-B]

%//Deg

In this case, the Cartan equations adopt now the form:

{Diff@ConnectionForm[cdv,VB][A,-B]==UseCartan[Diff@ConnectionForm[cdv,VB][A,-B],cdv],Diff@CurvatureForm[cdv,VB][A,-B]==UseCartan[Diff@CurvatureForm[cdv,VB][A,-B],cdv]}

We compute the integrability conditions of the Cartan system in this case.

Diff@%

UseCartan[%,cdv]

ToCanonical@%

One can carry out other interesting computations. For example take the expression:

CurvatureForm[cdv,VB][B,-A]⋀CurvatureForm[cdv,VB][C,-B]⋀CurvatureForm[cdv,VB][A,-C]

It is well known that this is a closed form (this is independent from the dimension). Let us check this:

Diff@%

UseCartan[%,cdv]

ToCanonical@%

This result generalizes to exterior powers of the curvature form with any number of factors. Since the exterior derivative is zero then there are local potentials for these expressions which can be explicitly found in terms of the so-called Chern-Simmons forms. We can check this result in a number of particular cases. Let us define first an index free version of the curvature 2-form and the connection 1-form.

DefDiffForm[ℱ[],M,2]

DefDiffForm[𝒜[],M,1]

We need some preliminary code to work with these forms:

DefInertHead[TR,LinearQ->True,PrintAs->"Tr"]

Grade[TR[expr_],Wedge]^:=Grade[expr,Wedge];

addfactor[expr1_,expr2_?xTensorQ]:=expr1⋀expr2[-First@Select[IndicesOf[Free][expr1],DownIndexQ],-NewIndexIn[VB]];

traceindex[expr_]:=expr/.UpIndex/@(Rule@@IndicesOf[Free][expr]);

rules={ℱ[]->CurvatureForm[cdv,VB],𝒜[]->ConnectionForm[cdv,VB]};

expandtrace=expr_TR:>With[{list=List@@First@expr/.rules},traceindex@Fold[addfactor,First[list][B,-A],Rest[list]]];

We are now ready to test our results. Let us start with the Chern-Simmons 3-form:

ChernSimmons3=TR[ℱ[]⋀𝒜[]-1/3𝒜[]⋀𝒜[]⋀𝒜[]]

%/.expandtrace

ToCanonical@%

We compute the exterior derivative of this object:

Diff@%

UseCartan[%,cdv]

ToCanonical@%

Similar computation for the Chern-Simmons 5-form.

ChernSimmons5=TR[ℱ[]⋀ℱ[]⋀𝒜[]-1/2ℱ[]⋀𝒜[]⋀𝒜[]⋀𝒜[]+1/10𝒜[]⋀𝒜[]⋀𝒜[]⋀𝒜[]⋀𝒜[]]

%/.expandtrace

ToCanonical@%

Diff@%

UseCartan[%,cdv]

ToCanonical@%

The Hodge dual requires the existence of a metric by definition. Once a metric is defined in the session, we can compute the Hodge dual of any differential form as follows

DefMetric[-1,metricg[-a,-b],CV,Torsion->True,PrintAs->"g"]

DefDiffForm[A0[],M,0,PrintAs->"(A^0)"]

DefDiffForm[A1[],M,1,PrintAs->"(A^1)"]

DefDiffForm[A2[],M,2,PrintAs->"(A^2)"]

DefDiffForm[A3[],M,3,PrintAs->"(A^3)"]

Hodge[metricg][A2[]]

Hodge[metricg][A0[]A1[]⋀A2[]+A1[]⋀A1[]⋀A1[]]

%//ToCanonical

Hodge duals of expressions involving the exterior product of canonical 1-forms can be worked out with ExpandHodgeDual. To illustrate this we need to give a value to the symbolic dimension and to the metric signature:

dim=4;

SignatureOfMetric[metricg]^={1,3,0};

SlotsOfTensor@epsilonmetricg^={-TangentM,-TangentM,-TangentM,-TangentM};

SymmetryGroupOfTensor@epsilonmetricg[a_,b_,c_,d_]^=Antisymmetric[{1,2,3,4},Cycles];

Coframe[M][a]⋀Coframe[M][b]⋀Coframe[M][c]

Hodge[metricg]@%

ExpandHodgeDual[%,Coframe[M],metricg]

Coframe[M][a]⋀Coframe[M][b]⋀Coframe[M][c]⋀Coframe[M][d]

Hodge[metricg]@%

ExpandHodgeDual[%,Coframe[M],metricg]

Hodge double dual

Hodge[metricg][A2[]]

Hodge[metricg]@%

Hodge[metricg][A0[]A1[]⋀A2[]]

Hodge[metricg]@%

The co-differential

Codiff[metricg][A2[]]

%//InputForm

The co-differential can be expressed in terms of the exterior derivative by using CodiffToDiff

CodiffToDiff@%

To illustrate how this works, let us compute the co-differential of the holonomic co-frame.

Codiff[metricg][dx[M][a]]

%//CodiffToDiff

ExpandHodgeDual[%,dx[M],metricg]

SeparateMetric[]@%

UseCartan[%,CV]

ConnectionFormToTensor[%,PD,dx]

ExpandHodgeDual[%,dx[M],metricg]

ToCanonical[ContractMetric@%,UseMetricOnVBundle->All]

The exterior covariant derivative is a graded differentiation and it is defined from any covariant derivative. The way in which this is done in xTerior is by adding a second argument to the exterior derivative Diff, indicating the covariant derivative which one uses to define the exterior covariant derivative.

We compute the exterior covariant derivative of the wedge product of two forms:

Diff[Coframe[M][a]⋀Coframe[M][b],CD]

We can write any instance of the exterior covariant derivative in terms of the ordinary exterior differential as follows:

ChangeExtD[%,CD,PD]

In the previous expression we have changed the exterior covariant derivative with respect to the covariant derivative CD to the exterior covariant derivative with respecto to PD. In xTensor the symbol PD represents the “trivial connection” on any manifold frame bundle. Therefore the exterior covariant derivative with respect to PD is equivalent to the plain exterior derivative. The exterior derivative is now worked out by using the Cartan equations.

UseCartan[%,CD]

We note that the exterior derivative is always internally regarded as a exterior covariant derivative with respect to the fiducial covariant derivative PD.

Diff@T[-a,-b]

%//InputForm

For the Levi-Civita covariant derivative one has additional properties.

Diff[metricg[-a,-b],CV]==0

ChangeExtD[%,CV,PD]

We check that the integrability conditions entailed by the previous expression are identically fulfilled.

Diff/@%

UseCartan[#,CV]&/@%

ContractMetric@%

ToCanonical[%,UseMetricOnVBundle->All]

The exterior covariant derivative with respect to the Levi Civita connection of the volume element tensor vanish.

Diff[epsilonmetricg[-a,-b,-c,-d],CV]==0

This condition yields the integrability condition:

Diff[#,CV]&/@%

The left hand side of the previous equality is an antisymetrization in four indices and hence it should be proportional to ({{ϵg, ({{ ,  ,  ,  }, {a, b, c, e}})}}) itself. Let us find the proportionality factor:

DefTensor[χ[],M]

One has

ToCanonical@Antisymmetrize[4epsilonmetricg[-a,-b,-c,-f]RiemannForm[CV][f,-e],{-a,-b,-c,-e}]==χ[]epsilonmetricg[-a,-b,-c,-e]

Times[epsilonmetricg[a,b,c,e],#]&/@%

ToCanonical/@(ContractMetric/@%)

One uses now the symmetries of the curvature 2-form. They imply that χ vanishes and hence the integrability condition is identically fulfilled.

ToCanonical[%,UseMetricOnVBundle->All]

We introduce a differential operator which shall be called Cartan derivative and it is defined in terms of the exterior covariant derivative and the inner contraction. It coincides with the standard Lie derivative when acting on forms with no indices.

We start by introducing a couple of vector fields.

DefTensor[ξ[a],M]

DefTensor[v[a],M]

In xTensor the Lie derivative is represented by the head LieD, see section 6.7 of xTensor documentation.

LieD[ξ[a]][Ω[]]

We use the xTensor command LieDToCovD to work out the Lie derivative (section 6.7 of xTensor documentation for a description of this command). Since the Lie derivative acts on a differential form, the result is rendered in terms of the “Cartan derivative” which is represented with the head CartanD.

LieDToCovD[%]

%//InputForm

Note the presence of a covariant derivative as a second argument. By default this covariant derivative is PD and we can expand this expression using the Cartan rule:

%//CartanDToDiff

Example with a covariant derivative different from PD. In this case the exterior derivative in the Cartan formula is replaced by the exterior covariant derivative:

CartanD[ξ[a]][Ω[],CV]

%//CartanDToDiff

The Cartan derivative with respect to any covariant derivative and the Lie derivative are equivalent when they act on forms with no tensor indices but they differ on tensor valued differential forms

LieD[ξ[a]]@Ω[]==CartanD[ξ[a]][Ω[],PD]

LieDToCovD/@%

LieD[ξ[a]]@τ[a]

LieDToCovD@%

exprA=CartanDToDiff@%

Since we did not specify any covariant derivative as argument of LieDToCovD the Cartan derivative is computed with respect to the fiducial PD. The result does not change if we supply any other covariant derivative as argument of LieDToCovD as we show next explicitly:

LieD[ξ[a]][τ[a]]

LieDToCovD[%,CV]

Note that now the Cartan derivative depends on the covariant derivative CV, eventhough the original Lie derivative does not depend on any choice of covariant derivative.

%//CartanDToDiff

ChangeExtD[%,CV,PD]

ChangeCovD[%,CV]

ConnectionFormToTensor[%,PD,Coframe]

TorsionToChristoffel@%

ToCanonical@%

exprA==%

Leibnitz rule for the Lie derivative of the wedge product of differential forms. Note that in this example we use a covariant derivative as an argument for LieDToCovD (see again section 6.7 of xTensor documentation).

Ω[]⋀η[]

LieD[ξ[a]]@%

LieDToCovD[%,CV]

%//CartanDToDiff

In this particular case the differential forms involved have no indices and hence the exterior covariant derivative coincides with the plain exterior derivative:

ChangeExtD[%,CV,PD]

When there is an expression which contains the exterior derivative, the inner contraction and the Cartan Lie derivative, then we can sort these derivations with SortDerivations. The canonical order is controlled through $DerivationSortOrder.
Examples of use of SortDerivations.

CartanD[ξ[a]]@CartanD[v[a]]@Ω[]-CartanD[v[a]]@CartanD[ξ[a]]@Ω[]

%//SortDerivations

Int[ξ[a]]@Int[v[a]]@η[]

%//SortDerivations

Int[ξ[a]]@CartanD[v[a]]@η[]

%//SortDerivations

$DerivationSortOrder

We change the canonical order and put the exterior derivative first:

$DerivationSortOrder={Diff,CartanD,Int}

CartanD[ξ[a]]@Diff[η[]]

%//SortDerivations

Int[ξ[a]]@Diff@η[]

%//SortDerivations

FormVarD is similar to the xTensor command VarD, but for top-rank forms. A derivative is not specified, because the exterior derivative is natural. Within this approach, the variation of the integral of a top-rank form also involves the adjoint to the exterior derivative. However, the adjoint to the exterior derivative, the codifferential, requires a Hodge dual, which it is defined via a (non-degenerate!) metric. Therefore, in addition to a form, FormVarD requires also a metric as an argument.

As the first example we take the Maxwell Lagrangian. We introduce first a 1-form representing the charge current

DefDiffForm[𝒥[],M,1]

The Maxwell Lagrangian  with kinetic term and source term is given by (we use symbols already introduced in the session to construct the Lagrangian

MaxwellL=(1/2)ℱ[]⋀Hodge[metricg]@ℱ[]+A1[]⋀Hodge[metricg]@𝒥[]

We have used (A^1) as the potential 1-form and  ℱ  as the electromagnetic 2-form. We need to go back and forth between the potential 1-form and the electromagnetic 2-form.

ℱtodA=MakeRule[{ℱ[],Diff[A1[],PD]}];
dAtoℱ=MakeRule[{Diff[A1[],PD],ℱ[]}];

The variation is done with respect to the potential 1-form, which is treated as the fundamental variable.

MaxwellL/.ℱtodA

0==FormVarD[A1[],metricg]@%

We remove the Hodge dual:

Hodge[metricg]/@%/.dAtoℱ

A more involved example: consider the Kinetic term of the Yang-Mills Lagrangian

LYM=With[{F=CurvatureForm[cdv,VB]},(1/2)F[A,-B]⋀Hodge[metricg]@F[B,-A]]

To compute the equations of motion of this Lagrangian, we need to write first the curvature 2-form in terms of the connection 1-form.

CurvatureForm[cdv,VB][A,-B]==(CurvatureForm[cdv,VB][A,-B]//ChangeCurvatureForm)

dAtoFRule=IndexSolve[%,Diff[ConnectionForm[cdv,VB][A,-B]]]

Next we write the Lagrangian itself in terms of the connection 1-form

(ChangeCurvatureForm@LYM/.Diff[expr_,PD]:>Diff@expr)

Finally we compute the actual variation using FormVarD (may freely apply Hodge to the result).

0==Hodge[metricg]@FormVarD[ConnectionForm[cdv,VB][B,-A],metricg]@%

We replace all the instances of the exterior derivative of the connection 1-form by using the above rule.

ToCanonical[%/.dAtoFRule]

This can be simplified even further if we write the exterior derivative in terms of the exterior covariant derivative with respect to the connection which we have in the previous expression. To that end we need to transform the co-differential into its definition in terms of the exterior derivative.

CodiffToDiff@%

ChangeExtD[%,PD,cdv]

ToCanonical@%

In this example we explain how to obtain the basic equations of the Einstein-Cartan theory starting from the Einstein-Hilbert Lagrangian written in terms of differential forms.

We introduce the  the spin current 3-form:

DefDiffForm[𝓈[-a,-b],M,3,Antisymmetric[{-a,-b}]]

Given that the volume element was defined for a symbolic dimension and we are now working in dimension four, we need to specify the slots of this tensor for the particular case of dimension four.

SlotsOfTensor@epsilonmetricg^={-TangentM,-TangentM,-TangentM,-TangentM};

Einstein-Hilbert Lagrangian:

EinsteinHilbert=RiemannForm[CV,TangentM][b,-a]⋀Hodge[metricg][Coframe[M][a]⋀Coframe[M][-b]]

EinsteinHilbertExpanded=ExpandHodgeDual[%,Coframe[M],metricg]

The variation of the Einstein-Hilbert Lagrangian with respect to the co-frame yields the Energy-Momentum 3-form

τ[-f]==FormVarD[Coframe[M][f],metricg]@EinsteinHilbertExpanded

CurvatureFormToTensor[%,Coframe]

Hodge[metricg]/@%

ExpandHodgeDual[%,Coframe[M],metricg]

ToCanonical[#,UseMetricOnVBundle->All]&/@(ContractMetric/@%)

%//RicciToEinstein

Simplification/@%

EinsteinA=%;

This is the first part of the Einstein equations “Matter is the source of curvature”.  Now we compute the variation of the Einstein-Hilbert Lagrangian with respect to the connection form which by definition is the spin current:

EinsteinHilbertExpanded/.(IndexSolve[CartanStructureEqs[[2]],RiemannForm[CD][a,-b]]/.CD->CV)

𝓈[-f,h]==FormVarD[ChristoffelForm[CV][f,-h],metricg][%]

ExpandHodgeDual[#,Coframe[M],metricg]&/@%

Expand//@%%

ToCanonical/@%

Hodge[metricg]/@%

CodiffToDiff/@%

%/.MakeRule[{epsilonmetricg[-a,-b,-c,-d],epsilonmetricg[-a,-b,-c,-d]},MetricOn->All,ContractMetrics->False]

UseCartan[%,CV]

Hodge[metricg]/@%

ToCanonical/@(ContractMetric/@%)

ToCanonical[#,UseMetricOnVBundle->All]&/@%

%/.h->-h

ConnectionFormToTensor[%,PD,Coframe]

Hodge[metricg]/@%

ExpandHodgeDual[#,Coframe[M],metricg]&/@%

ToCanonical@ContractMetric@%

ToCanonical[#,UseMetricOnVBundle->All]&/@%

Hodge[metricg]/@%

This is the second set of Einstein equations (The spin current generates the torsion).

We set now the manifold dimension to four: This requires that we also set the signature of the metric tensor and the volume element tensor slots:

dim=4;

UseDimensionStart[]

SignatureOfMetric@metricg^={3,1,0};

SlotsOfTensor@epsilonmetricg^={-TangentM,-TangentM,-TangentM,-TangentM};

SymmetryGroupOfTensor@epsilonmetricg[a_,b_,c_,d_]^=Antisymmetric[{1,2,3,4},Cycles];

Let us introduce a specific metric in our session. We choose the Schwarzschild metric and we only need to supply the components of the metric tensor in a chart or a frame. There are different ways of doing this; here we follow the procedure described in the notebook xCobaDoc2.nb (section 5.2) under the xCoba documentation directory.

$CVVerbose=False;

DefConstantSymbol[mass,PrintAs->"m"]

DefChart[Sch,M,{0,1,2,3},{t[],r[],θ[],φ[]},FormatBasis->{"Partials","Differentials"},ChartColor->RGBColor[0,0,1]]

We choose the Schwarzschild metric in Schwarzschild coordinates as the specific metric:

SchwarzschildMetric={{-1+mass/r[],0,0,0},{0,(1-mass/r[])^(-1),0,0},{0,0,r[]^2,0},{0,0,0,r[]^2 Sin[θ[]]^2}}

We need to declare this as the metric tensor. We get a warning message informing that a metric was previously introduced in the session:

SchwarzschildMetric=CTensor[SchwarzschildMetric,{-Sch,-Sch}]

SetCMetric[SchwarzschildMetric,Sch,SignatureOfMetric->{3,1,0}]

We compute the components of the Riemann tensor. This computes automatically the necessary Christoffel symbols.

MetricCompute[SchwarzschildMetric,Sch,"Riemann"[-1,-1,-1,1]]

cv=CovDOfMetric@SchwarzschildMetric;

We can now show the values of the the connection 1-form and the curvature 2-form.

ChristoffelForm[CV][a,-b]==(ChristoffelForm[cv][a,-b]/.Coframe->dx)

We express this in terms of the coordinate differentials

christoffelform=ToValues@%

RiemannForm[CV][-a,b]==(RiemannForm[cv][-a,b]/.Coframe->dx)

We express this in terms of the coordinate differentials

riemannform=ToValues@%

From these expressions it is possible to extract single components of the connection 1-form:

ToBasis[Sch]@christoffelform

Flatten@ComponentArray@%

Map[Simplify,%,{2}]

We store these values

%/.Equal->ComponentValue;

ToBasis[Sch]@riemannform

Flatten@ComponentArray@%

Map[Simplify,%,{2}]

%/.Equal->ComponentValue;

Computation of the volume element:

1/4!epsilon[SchwarzschildMetric][-a,-b,-c,-d]dx[M][a]⋀dx[M][b]⋀dx[M][c]⋀dx[M][d]

PowerExpand@ToValues@%

We can compute Hodge duals of expressions in explicit coordinate representations too. For example:

Hodge[SchwarzschildMetric][Diff@t[]]

ExpandHodgeDual[%,dx[M],SchwarzschildMetric]

ToValues@PowerExpand@%

%/.metricg->Inv@SchwarzschildMetric

Diff@t[]⋀Diff@r[]⋀Diff@θ[]

Hodge[SchwarzschildMetric]@%

ExpandHodgeDual[%,dx[M],SchwarzschildMetric]/.metricg->Inv[SchwarzschildMetric]

ToValues@PowerExpand@%

To ilustrate how one works with the co-differential, we compute next explicitly the Laplace operator in the Schwarzschild coordinates which we introduced in this session. Recall that the Laplace operator can be defined invariantly in terms of the exterior derivative and the co-differential in the following way:

DefScalarFunction[F]

hodgelaplacian=Codiff[metricg]@Diff[F@@ScalarsOfChart@Sch]+Diff@Codiff[metricg][F@@ScalarsOfChart@Sch]

We write the co-differential in terms of the exterior derivative and work out the Hodge duals in the resulting expression

CodiffToDiff[%/.metricg->SchwarzschildMetric]

ExpandHodgeDual[%,dx[M],SchwarzschildMetric]/.metricg->Inv[SchwarzschildMetric]

ExpandHodgeDual[%,dx[M],SchwarzschildMetric]/.metricg->Inv[SchwarzschildMetric]

Simplify//@%

MaxMemoryUsed[]

TimeUsed[]

Note: For further information about xTerior`, and to be kept informed about new releases, you may contact the authors electronically at agparrado@uco.es, leo.stein@gmail.com. This is xTeriorDoc.nb, the docfile of xTerior`, currently in version 0.9.1.

?xAct`xTerior`*