xTensor: fast abstract tensor computer algebra

First steps with xTensor

Load xTensor by following either of the following procedures:

Needs["xAct`xTensor`"]

<<xAct/xTensor.m

<<xAct`xTensor`

Full list of symbols of xTensor:

?xAct`xTensor`*

Names["xAct`xTensor`*"]//Length

Full list of symbols of xPerm:

?xAct`xPerm`*

Names["xAct`xPerm`*"]//Length

General idea of type in xTensor

The WL is an untyped language, but it is convenient to use a type-definition system to do tensor calculus. xTensor has its own type system:

xAct`xTensor`Private`$Types

Types in xTensor are defined and undefined through appropriate DefType functions:

DefType[Object, Properties]

UndefType[object]

The  DefType defines upvalues or downvalues for the properties of the object. All these properties are changeable by the user when needed:

PropertyUpvalue[Object]^=Value1

PropertyDownvalue[Object]:=Value2

In addition each type has its corresponding predicate:

{AbstractIndexQ,ManifoldQ,MappingQ,VBundleQ,TensorQ,MetricQ,CovDQ,InertHeadQ,ScalarFunctionQ,ConstantSymbolQ,ParameterQ,ProductQ,ChartQ,BasisQ}

Use the predicate to register a symbol as belonging to a type. This is useful if we need to bypass the corresponding DefType command (see later for examples):

TypeQ[object]^=True;

In addition each type has associated a global variable to store the defined symbols of the type :

{$Manifolds,$AbstractIndices,$Mappings,$VBundles,$Tensors,$Metrics,$CovDs,$InertHeads,$ScalarFunctions,$ConstantSymbols,$Parameters,$Products,$Charts,$Bases}

Relation between the different types. The arrows mean that the parent, called the host, is required to define objects belonging to the corresponding type (its visitors):

When using a DefType function to introduce a symbol of one of the types, new objects which might belong to different types are automatically defined. These are called the servants of the symbol we are introducing and the former is the master:

Type Manifold

The type Manifold is perhaps the most important type.

?DefManifold

We introduce a manifold:

DefManifold[M4,4,{a,b,c,d,e,f,g,h}]

The properties of our manifold are stored by means of upvalues attached to the symbol defining the manifold. Note that all information about the manifold is local, there is no information about the topology:

?M4

List of manifolds:

$Manifolds

When we define a manifold its tangent bundle is automatically defined:

ServantsOf@M4

%//InputForm

The tangent bundle is a vector bundle:

VBundleQ@TangentM4

$VBundles

Type AbstractIndex

In xTensor, tensor analysis is carried out using the notion of abstract index. As already seen, abstract indices are given as arguments of DefManifold . Even though there exist DefAbstractIndex / UndefAbstractIndex,  in principle, they are not to be used by the user.

?a

Query the list of abstract indices of a given vector bundle:

IndicesOfVBundle@TangentM4

Complete list of abstract indices:

$AbstractIndices

Type Tensor

Elements of the type Tensor are always tensor fields on a given vector bundle. Tensors are defined following to the abstract index framework:

?DefTensor

Define a contravariant vector field:

DefTensor[v[a],M4]

As always the properties are stored by means of upvalues attached to the tensor symbol:

?v

The manifold M4 and the tangent bundle TangentM4 acquire now a visitor:

VisitorsOf@M4

VisitorsOf@TangentM4

Scalar fields on a manifold are a particular case of tensor fields: they are tensors with no indices:

DefTensor[ϕ[],M4]

It is possible to define complex scalar fields. In this case the complex conjugate scalar field is automatically defined:

DefTensor[ψ[],M4,Dagger->Complex]

ServantsOf@ψ

Use the keyboard shortcut EscdgEsc to type the complex conjugate symbol †. Pretty printing of the complex scalar field:

PrintAs@ψ†^="(OverBar[ψ])";

ψ[]ψ†[]

Do not confuse a scalar field with a scalar function. The latter corresponds to the type ScalarFunction and it will be studied latter:

?ScalarFunction

Mono-term symmetries of Tensors

Mono-term symmetries of tensors can be regarded as subgroups of the group (Subscript[ℤ, 2])×(Subscript[S, n]) for an appropriate n . For a given subgroup G⊂(Subscript[ℤ, 2])×(Subscript[S, n]) we can choose a set of elements generating G (the generating set) and use this generating set to represent the symmetry of a tensor having G as its group of mono-term symmetries. What this really means is that for any g∈G we have the property g·T=±T.

This is a permutation:

Cycles[{1,2}]

Product of permutations:

PermProduct[Cycles[{1,2}],Cycles[{1,2}]]

Group generated by the permutation:

Dimino@GenSet[Cycles[{1,2}]]

More examples of permutations:

{Cycles[{1,2},{3,4}],Cycles[{1,3},{2,4}]}

The generated group:

Dimino[GenSet@@%]

There are specific notations for some special cases of mono-term symmetries:

Symmetric[{1,2,3}]

GenSet@%

The elements of the generated group are related to the possible index permutations which leave invariant a tensor:

Dimino@%

Antisymmetric[{1,2,3}]

Note how the minus sign is used to denote the antisymmetry:

GenSet@%

%//InputForm

Dimino@%

Mono-term symmetries of the Riemann tensor:

RiemannSymmetric[{1,2,3,4}]

Again note the relation between the generated group and the index permutations leaving invariant a tensor:

Dimino@%

With these ideas, we can define tensors with any mono-term symmetry by just giving the generating set of the symmetry group (with the appropriate signs) or using any of the special notations just described. Example:

DefTensor[F[-a,-b],M4,Antisymmetric[{-a,-b}]]

The antisymmetry property is incorporated into the list of properties of the tensor:

?F

The antisymmetry property is used for canonicalization:

F[-a,-b]+F[-b,-a]//ToCanonical

Another example:

DefTensor[R[-a,-b,-c,-d],M4,RiemannSymmetric[{-a,-b,-c,-d}]]

SymmetryGroupOfTensor@R

Checks:

R[-a,-b,-c,-d]-R[-c,-d,-a,-b]//ToCanonical

R[-a,-b,-c,-d]+R[-b,-a,-c,-d]//ToCanonical

More examples:

DefTensor[L[-a,-b,-c,-d,-f],M4,GenSet[-Cycles[{1,2}],Cycles[{1,3},{2,4}],-Cycles[{4,5}]]]

L[-a,-b,-c,-d,-f]+L[-b,-a,-c,-d,-f]//ToCanonical

L[-a,-b,-c,-d,-f]+L[-a,-b,-c,-f,-d]//ToCanonical

L[-a,-b,-c,-d,-f]-L[-c,-d,-a,-b,-f]//ToCanonical

Summary

Tensors are represented as WL expressions. The head of the expression is the tensor name and the arguments of the expression are the tensor indices.

Mono-term symmetries of tensors are a subgroup of (Subscript[ℤ, 2])×(Subscript[S, n]). They are stored among the properties of the tensor

ToCanonical is the most important command of xTensor. It canonicalizes tensor expressions taking into account the tensor symmetries.

?ToCanonical

Exercises

Exercise 1

How would you define a totally symmetric tensor like the following one.

Y[ω][-a,-b,-c]

Answer

In this case it is not possible to use DefTensor directly:

DefTensor[Y[ω][-a,-b,-c],M4,Symmetric[{-a,-b,-c}]]

AtomQ[Y[ω]]

We can bypass DefTensor and do the definition “by hand”. Add the corresponding definitions as upvalues:

xTensorQ[Y[ω]]^=True;
Dagger[Y[ω]]^=Y[ω];
DependenciesOfTensor[Y[ω]]^={M4};
HostsOf[Y[ω]]^={M4,TangentM4};
PrintAs[Y[ω]]^="Y(ω)";
SlotsOfTensor[Y[ω]]^={-TangentM4,-TangentM4,-TangentM4};
SymmetryGroupOfTensor[Y[ω]]^=Symmetric[{1,2,3}];
TensorID[Y[ω]]^={};

Now we can work with the tensor:

Y[ω][-a,-b,-c]

The symmetries are recognized:

Y[ω][-a,-b,-c]-Y[ω][-b,-a,-c]//ToCanonical

Exercise 2

Suppose that you define a tensor:

DefTensor[Z[-a,-b,-c],M4]

and during your computation you discover that the tensor is antisymmetric in the first pair of indices. How can you add this symmetry property of the tensor (Subscript[Z, abc]) “on the fly”?

Answer

The tensor has no symmetries:

SymmetryGroupOfTensor@Z

We need to add the discovered symmetry as an upvalue of the symbol which represents the tensor. This is the symmetry we want to add:

GenSet[-Cycles[{1,2}]]

Next, we need to compute a strong generating set for the symmetry group. Use the Schreier-Sims algorithm for that:

SchreierSims[{1,2},GenSet[-Cycles[{1,2}]],3]

Finally, add the symmetry as an upvalue:

SymmetryGroupOfTensor@Z^=StrongGenSet[{1,2},GenSet[-(1,2)]];

Now the tensor is antisymmetric in the first pair of indices

Z[-a,-b,-c]+Z[-b,-a,-c]//ToCanonical

In this particular case there is an alternative way of adding the information about the antisymmetry:

SymmetryGroupOfTensor@Z^=Antisymmetric[{1,2}];

Z[-a,-b,-c]+Z[-b,-a,-c]//ToCanonical

Type covariant derivative

Let ℱ(ℳ) be a vector bundle with the base manifold ℳ and let X, Y be tensor fields on ℱ(ℳ). In the abstract index framework, a covariant derivative (Subscript[▽, a]) is an operator obeying the following properties:
	1) (Subscript[▽, a])(X+Y)=(Subscript[▽, a])X+(Subscript[▽, a])Y.
	2) (Subscript[▽, a])(X·Y)=Y·(Subscript[▽, a])X+X·(Subscript[▽, a])Y.
	3)  (Subscript[▽, a])f=d f for any scalar field f.
	4) Commutativity of (Subscript[▽, a]) with the index contraction.
This corresponds to the standard notion of linear connection or Koszul connection introduced in differential geometry.

?DefCovD

Introduce a covariant derivative with DefCovD:

DefCovD[covd[-a],Torsion->True,SymbolOfCovD->{"|","𝒟"}]

Conventions for the definition of the Riemann tensor and the Torsion tensor are fully adjustable:

{$TorsionSign,$RiemannSign}

When defining a covariant derivative, a number of objects are automatically defined:

ServantsOf@covd

Commutation of the covariant derivatives:

covd[-a][ covd[-b][ Riccicovd[-c,-d] ] ]

%//SortCovDs

Dollar indices are created automatically during the computation to avoid dummy index collision. Use ScreenDollarIndices to remove them:

%//ScreenDollarIndices

Have ScreenDollarIndices automatically applied to every output:

$PrePrint=ScreenDollarIndices;

%%

Postfix notation for the covariant derivative:

$CovDFormat="Postfix";

%%

Usual prefix notation for the covariant derivative :

$CovDFormat="Prefix";

%%

The reference covariant derivative

Suppose now that (Subscript[𝒟, b]) is an affine connection (connection in the tangent bundle of a manifold). Consider then the following equation: 

	(Subscript[𝒟, b])(v^a)=(∂_b)(v^a)+(Subscript[(Γ^a), bc])(v^c).

As we all know very well, this is the expansion in a coordinate system of the covariant derivative of a tensor in terms of the Christoffel symbols or connection coefficients. The connection coefficients are not tensors but in the abstract index formalism we can only work with quantities which represent tensors as the abstract indices do not make reference to any base. What is the way out?

The point of view adopted is to consider that the quantities (Subscript[(Γ^a), bc]) are true tensors which are the difference of two affine connections. The first connection is  (Subscript[𝒟, b]) and the second connection is (∂_b). Since (∂_b) corresponds to a coordinate system it has particular mathematical properties but the idea applies to any pair of covariant derivatives. In this sense we can re-write the equation as follows:
	
	(Subscript[𝒟, b])(v^a)=(∂_b)(v^a)+(Subscript[(Γ^a), bc])(𝒟,∂)(v^c).

The quantity (Subscript[(Γ^a), bc])(𝒟,∂) is now a true tensor representable with abstract indices which by definition does not make reference to any base. It is called the Christoffel tensor and it is a true tensor because it is the difference of two affine connections:

	(Subscript[(Γ^a), bc])(𝒟,∂)=(Subscript[(Γ^a), bc])(𝒟)-(Subscript[(Γ^a), bc])(∂).

In xTensor there is a predefined covariant derivative called PD, with zero torsion and curvature called the reference covariant derivative or default covariant derivative. The reference covariant derivative is always the covariant derivative compatible with a coordinate system, and vice-versa. We can think of this covariant derivative as the set of partial derivatives with respect to the chart coordinates. That motivates its name PD:

?PD

List of covariant derivatives:

$CovDs

Examples:

PD[-a]@F[-b,-c]

PD[-a]@PD[-b]@F[-c,-d]

SortCovDs[%]

Christoffel tensor with respect to the default covariant derivative:

Christoffel[covd,PD][a,-b,-c]

For the sake of simplicity, the default covariant derivative is omitted but its presence must be always understood:

%//InputForm

Use ChangeCovD to expand any covariant derivative in terms of Christoffel tensors:

?ChangeCovD

covd[-a]@v[b]

ChangeCovD[%,covd]

Expansion of the Riemann curvature in terms of the Christoffel tensors with respect to the default covariant derivative PD:

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

%//RiemannToChristoffel

Expansion of the Torsion in terms of the Christoffel tensors with respect to the default covariant derivative PD:

Torsioncovd[a,-b,-c]

%//TorsionToChristoffel

General Christoffel tensors

In general if we have 2 covariant derivatives 𝒟 and ∇ defined from affine connections, then we have the formula:

	(Subscript[𝒟, b])(v^a)=(Subscript[∇, b])(v^a)+(Subscript[(Γ^a), bc])(𝒟,∇)(v^c).

The quantity (Subscript[(Γ^a), bc])(𝒟,∇) is a true tensor called the Christoffel tensor and it is the difference of the affine connections defined by (Subscript[𝒟, b]) and (Subscript[∇, b]). In this sense whenever we speak of the “expansion of a covariant derivative in terms of the connection coefficients” what we mean is that we are expressing the covariant derivative with respect to ANOTHER COVARIANT DERIVATIVE which we have chosen as the reference.

The xTensor functions ChangeCovD, ChangeCurvature and ChangeTorsion allow us to replace the connection (Subscript[𝒟, b]) in a given expression with the connection  (Subscript[∇, b]) inserting the appropriate Christoffel tensors. ChangeCurvature is the generalization of
RiemannToChristoffel  and ChangeTorsion is the generalization of TorsionToChristoffel.

Introduce a second covariant derivative:

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

$CovDs

Take the covariant derivative of a vector field:

covd[-b]@v[a]

Expand with respect to ∇ .The Christoffel tensor is automatically defined:

ChangeCovD[%,covd,CD]

More involved examples:

DefTensor[X[a,-b],M4]

expr= covd[-a]@X[b,-c]

ChangeCovD[expr,covd,CD]

ChangeCovD[%,CD,covd]

This only affects (Subscript[∇, a])({{X, ({{b,  }, { , c}})}}) :

ChangeCovD[%%,CD,PD]

Write the tensor ({{Γ[∇,𝔇], ({{d,  ,  }, { , a, c}})}}) as the explicit difference of two Christoffel tensors defined with respect to the default covariant derivative:

%//BreakChristoffel

%//ToCanonical

This is the same as expanding the original expression in terms of the default covariant derivative:

ChangeCovD[expr,covd,PD]

%%-%//ToCanonical

Use ChangeCurvature to write the Riemann tensor of a given connection in terms of the Riemann tensor of another connection:

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

ChangeCurvature[%,CD,covd]

We can recover the original expression in a few steps:

ChangeCurvature[%,covd,CD]

ChangeCovD[%,covd,CD]

ChangeTorsion[%,CD,covd]

%//ToCanonical

Summary

Covariant derivatives are operators acting on abstract index tensors.

A covariant derivative (Subscript[𝒟, b]) defined from an affine connection can be expanded with respect to another covariant derivative (Subscript[∇, b]) using the notion of Christoffel tensor:

(Subscript[𝒟, b])(v^a)=(Subscript[∇, b])(v^a)+(Subscript[(Γ^a), bc])(𝒟,∇)(v^c)

There is a reference or default covariant derivative called PD. It corresponds to the covariant derivative compatible with a generic coordinate system.

The most important commands when working with covariant derivatives are ChangeCovD, ChangeCurvature and ChangeTorsion:

?ChangeCovD

?ChangeCurvature

?ChangeTorsion

If the second covariant derivative is PD then we can use RiemannToChristoffel in place of ChangeCurvature , TorsionToChristoffel in place of ChangeTorsion and CovDToChristoffel in place of ChangeCovD:

?RiemannToChristoffel

?TorsionToChristoffel

?CovDToChristoffel

Exercises

Exercise 1

Prove the general Bianchi identities for a general affine connection with torsion:

Hint: first Bianchi identity. Start from the expression:

Riemanncovd[-a,-b,-c,d]+covd[-a][ Torsioncovd[d,-b,-c] ]-Torsioncovd[e,-a,-b]Torsioncovd[d,-c,-e]

and prove that the following vanish:

Bianchi1=Antisymmetrize[3%,{-a,-b,-c}]//ToCanonical

Hint: second Bianchi identity. Start from the expression:

covd[-a][ Riemanncovd[-b,-c,-d,e] ]-Torsioncovd[f,-a,-b]Riemanncovd[-c,-f,-d,e]

and prove that the following vanish:

Bianchi2=Antisymmetrize[3%,{-a,-b,-c}]//ToCanonical

Answer

First Bianchi identity :

Bianchi1//CovDToChristoffel

%//RiemannToChristoffel

%//TorsionToChristoffel

%//ToCanonical

Second Bianchi identity :

Bianchi2

%//CovDToChristoffel

%//RiemannToChristoffel

%//TorsionToChristoffel

%//ToCanonical

Type VBundle

To define a vector bundle we need a manifold (the base manifold) and the fibres which are diffeomorphic to a vector space. In xTensor we use a set of abstract indices to represent the fibres:

?DefVBundle

Tensors defined in a vector bundle ℱ(ℳ) will in general have two types of abstract indices: the abstract indices of the tangent bundle of the base manifold ℳ and the abstract indices associated to the fibre F of the vector bundle.

We have already encountered a vector bundle: the tangent bundle.

?TangentM4

Define a complex vector bundle with base manifold M4:

DefVBundle[SU2,M4,2,{A,B,G,H,J,M},Dagger->Complex]

The vector bundle and its complex conjugate are automatically defined:

ServantsOf@SU2

?SU2

?SU2†

Note that since the vector bundle SU2 is complex, we need two sets of abstract indices: one for SU2 and another for its complex conjugate:

IndicesOfVBundle@SU2

IndicesOfVBundle@SU2†

Tensors on the new vector bundle are defined in the natural way. We only need to bear in mind that we are working on a complex vector bundle:

DefTensor[ξ[A],M4]

DefTensor[ξ[A],M4,Dagger->Complex]

ServantsOf@ξ

The complex conjugate is implemented with the function Dagger.  Use the keyboard shortcut EscdgEsc to type the complex conjugate symbol †

ψ[]ξ[A]//Dagger

%//Dagger

ψ†[]ξ†[A†]//Dagger

%//Dagger

It is possible to change the default formatting output of the abstract indices and the tensors:

PrintAs[A†]^="(OverBar[A])";PrintAs[B†]^="(OverBar[B])";PrintAs[G†]^="(OverBar[G])";PrintAs[J†]^="(OverBar[J])";PrintAs[M†]^="(OverBar[M])";

PrintAs[ξ†]^="(OverBar[ξ])";PrintAs[ψ†]^="(OverBar[ψ])";

ψ[]ξ[A]//Dagger

Definition of a tensor field with indices in the tangent bundle and in the vector bundle:

DefTensor[U[a,B],M4,Dagger->Complex]

?U

?U†

VisitorsOf@SU2

Computing the complex conjugate:

PrintAs@U†^="(OverBar[U])";

ψ[]U[a,B]

%//Dagger

Covariant derivatives in vector bundles

When working with a covariant derivative (Subscript[D, a]) on a general vector bundle ℱ(ℳ) we have two sets of connection tensors: the ones arising from the restriction of (Subscript[D, a]) to tensor fields constructed from T(ℳ) (tangent bundle) and the connection tensors arising from the restriction of (Subscript[D, a]) to tensor fields constructed from 𝒮(ℳ)∼ℳ×F (the vector bundle):

	(Subscript[D, a])(v^b)=(∂_a)(v^b)+(Subscript[((Γ(D,∂))^b), a c])(v^c),
	(Subscript[D, a])(ξ^A)=(∂_a)(ξ^A)+(Subscript[((A(D,∂))^A),  a B])(ξ^B).

We follow the same viewpoint as in the case of the covariant derivatives defined on the tangent bundle: the quantities (Subscript[((A(D,∂))^A), a B]) are regarded as tensors and they are defined as the difference between 2 connections.

Similarly there are two curvature tensors: the standard Riemann tensor and the curvature of the connection defined on the vector bundle:  
	
	(Subscript[D, a])(Subscript[D, b])(v^c)-(Subscript[D, b])(Subscript[D, a])(v^c)=((Subscript[R(D), a b d])^c)(v^d),
	(Subscript[D, a])(Subscript[D, b])(ξ^A)-(Subscript[D, b])(Subscript[D, a])(ξ^A)=((Subscript[F(D), a b B])^A)(ξ^B).

The already seen xTensor functions ChangeCovD, ChangeCurvature and ChangeTorsion allow us to replace the connection (Subscript[D, a]) in a given expression with any other connection inserting the appropriate connection tensors.

To learn more see: 
A. Ashtekar,  G.T. Horowitz and A. Magnon-Ashtekar A generalization of tensor calculus and its applications to physics 
Gen. Rel. Grav. 14, 411-428 (1982).
https://link.springer.com/article/10.1007/BF00756326

Define a covariant derivative in the complex vector bundle SU2:

DefCovD[ICD[-a],SU2,SymbolOfCovD->{"#","D"},Torsion->True]

Note that in addition to the standard objects defined for an ordinary covariant derivative on a tangent bundle, we have the additional AChristoffelICD and FRiemannICD  :

ServantsOf@ICD

Change of covariant derivative:

ICD[-a][U[b,A]]

ChangeCovD[%]

Note the presence of the two kinds of connection coefficients:

%//ScreenDollarIndices//InputForm

Another example:

ICD[-a][U†[b,A†]]

In this case it is necessary to remember that we are working with a complex vector bundle. Hence we need the connection tensors and their complex conjugates:

ChangeCovD[%,ICD,covd]

Commutation of derivatives (Ricci identity):

ICD[-a]@ICD[-b][U[c,A]]

SortCovDs[%]

Note the presence of two kinds of curvature tensors: the “internal” curvature  ({{F[D], ({{ ,  ,  , A}, {b, a, B,  }})}}) and the usual Riemann curvature tensor ({{R[D], ({{ ,  ,  , c}, {b, a, d,  }})}}).

%//ScreenDollarIndices//InputForm

The “internal curvature” can be expressed in terms of the “internal connection”:

FRiemannICD[-a,-b,-A,B]==ChangeCurvature[FRiemannICD[-a,-b,-A,B],ICD]

Example with the complex conjugate:

ICD[-a]@ICD[-b][U†[c,A†]]

SortCovDs[%]

We check the second Bianchi identity for the “internal curvature”.

ICD[-a]@FRiemannICD[-b,-c,-A,B]+ICD[-b]@FRiemannICD[-c,-a,-A,B]+ICD[-c]@FRiemannICD[-a,-b,-A,B]-TorsionICD[d,-a,-b]RiemannICD[-c,-d,-A,B]-TorsionICD[d,-b,-c]RiemannICD[-a,-d,-A,B]-TorsionICD[d,-c,-a]RiemannICD[-b,-d,-A,B]

ChangeCurvature[%,ICD]

ChangeCovD[%,ICD]

TorsionToChristoffel@%

%//ToCanonical

Summary

A real or complex vector bundle can be defined taking any existing manifold as the base manifold of the bundle.

The fibres are represented by means of a set of abstract indices.

Tensors and covariant derivatives can be defined in a vector bundle in the natural way.

For a covariant derivative we have two types of connection tensors: the usual Christoffel tensor arising from the restriction of the covariant derivative to the tangent bundle tensor fields and the connection tensor (“internal connection”) arising from the action of the covariant derivative on the vector bundle tensor fields. Something similar happens with the curvature (Riemann curvature and “internal curvature”).

Exercises

Exercise 1

Define a covariant derivative in a vector bundle by extending an already existing covariant derivative in the tangent bundle of a manifold.

Answer

This is the list of covariant derivatives:

$CovDs

And this is the list of their vector bundles:

VBundlesOfCovD/@%

Note that the tangent bundle is always the first element of the list. This is because any covariant derivative always acts on tensor fields of the tangent bundle. Now check the options of DefCovD:

Options@DefCovD

This is the option we need:

?ExtendedFrom

We define a new covariant derivative in the bundle SU2 which extends covd:

DefCovD[covde[-a],SU2,{"|","(OverBar[𝒟])"},ExtendedFrom->covd]

The new covariant derivative requires covd to exist:

HostsOf@covde

It has its own “internal” connection tensor and “internal” curvature:

ServantsOf@covde

Both covariant derivatives agree on tensors

{covde[-a]@v[b],covd[-a]@v[b]}

ChangeCovD/@%

ScreenDollarIndices/@%

Union@%

But in addition covde can act on tensor fields of the vector bundle SU2:

covde[-a]@ξ[A]

ChangeCovD[%]

This is not the case with the original covd:

covd[-a]@ξ[A]

ChangeCovD[%]

Relation between the “internal” curvature tensors of the vector bundle covariant derivatives ICD and covde

FRiemannICD[-a,-b,-A,B]==ChangeCurvature[FRiemannICD[-a,-b,-A,B],ICD,covde]

Exercise 2

Undefine all the symbols in the present session of xTensor.

Answer

Start by finding out the covariant derivatives and their visitors:

$CovDs

VisitorsOf/@%

Undefine the visitor:

UndefCovD@covde

Now, the covariant derivatives have no visitors:

$CovDs

VisitorsOf/@%

Therefore, they can be all undefined except the reference PD:

UndefCovD/@Rest@$CovDs;

Now let’s look at the list of vector bundles and their visitors:

$VBundles

VisitorsOf/@%

Flatten@%

We undefine the visitors:

UndefTensor/@%;

We can now undefine SU2, and SU2. TangentM4 cannot be undefined because it has a master:

MasterOf@TangentM4

MasterOf@SU2

%//InputForm

Rest@$VBundles

It is enough to undefine SU2 because that will automatically undefine SU2†:

UndefVBundle@SU2

Finally, we look at the visitors of M4:

VisitorsOf@M4

Most@%

UndefTensor/@%;

The manifold M4 can now be undefined:

UndefManifold@M4

Only default symbols are left in the Global` context:

?Global`*

Bianchi1=.

Bianchi2=.

expr=.

Remove/@{Bianchi1,Bianchi2,expr,Y,ω};