TensorD / TensorDerivative

New approach to derivatives in xAct

This notebook describes a new way of dealing with derivatives in xAct. There are three ideas:
	- We make use of the nonatomic heads for tensors to store derivatives in a tensor head, what makes all objects to have the structure tensor[indices].
	- We analyze in real time whether indices have been moved with a metric with respect to their original positions. If so, we separate the metric, differentiate it and contract it again. This behaves like the Implode command.
	- In the same spirit, basis indices are separated, differentiated and contracted again.

There are four new reserved words: TensorDerivative, ToTensorDerivative, FromTensorDerivate and TensorD.

Commands like SortCovDs have not been yet updated to deal with this new notation for derivatives.

I thank Alfonso García-Parrado and Guillaume Faye for very useful conversations and suggestions on derivatives in xAct.

			Jose M. Martín-García, Madrid 2010, for xTensor 1.0.0

Setup

<<xAct`xTensor`

$PrePrint=ScreenDollarIndices;

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

DefTensor[V[a],M]

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

DefMetric[-1,metric[-a,-b],CD,PrintAs->"g"]

Simplest example

Take the expression, in the standard xTensor representation of derivatives:

PD[-a][V[b]]

%//InputForm

We now can convert that expression into the following alternative form :

ToTensorDerivative[%]

%//InputForm

Note the position of the derivative index, at the end of the tensor, in the same way that PD has been placed to the right of V.

The head TensorDerivative[V, PD] is accepted as a tensor:

Head[%]

xTensorQ[%]

We can come back to the standard representation:

TensorDerivative[V,PD][b,-a]

FromTensorDerivative[%]

%//InputForm

We can differentiate the expression using

TensorD[V[b],PD[-a]]

which converts to TensorDerivative notation, in the same way that Mathematica' s D converts into Derivative.

With a metric

We now start from a tensor in which the index has been moved with the metric :

PD[-a][V[-b]]

Now the conversion to TensorDerivative notation is

ToTensorDerivative[%]

%//ScreenDollarIndices//InputForm

Note that if we take the last term and use SeparateMetric we get the original form of the tensor :

Last[%]

SeparateMetric[][%]

This is similar to the behaviour of the imploded forms.

More derivatives

Take an expression like

PD[-b][PD[-a][V[b]]]

Convert:

%//ToTensorDerivative

%//InputForm

We can go back :

%%//FromTensorDerivative

%//InputForm

Note :

TensorDerivative[V,PD,PD][a,-b,-c]-TensorDerivative[V,PD,PD][a,-c,-b]

%//ToCanonical

Compare with other notations

PD[-a][T[-b,c,d]]

%//ToTensorDerivative

%//ScreenDollarIndices//InputForm

%%//FromTensorDerivative

If we move the indices :

expr=PD[b][PD[-a][V[-b]]]

AbsoluteTiming[ToCanonical[expr,ExpandChristoffel->True]]

AbsoluteTiming[Implode[expr]]

AbsoluteTiming[ToTensorDerivative[expr]]

FromTensorDerivative[Last[%]]

TensorD

PD[-c][PD[-a][T[-b,c,d]]]

%//ToTensorDerivative

%//FromTensorDerivative

We can combine the action of taking derivatives and ToTensorDerivative :

expr=TensorD[T[-a,-b,-c],PD[-d],PD[-e],PD[-f]]

%//FromTensorDerivative

%//InputForm

With xCoba

The great advantage of TensorDerivative is that it is a normal tensor, and hence much simpler to user in xCoba.

<<xAct`xCoba`

DefBasis[B,TangentM,{0,1,2,3}]

Simplest case :

PD[-e][V[{a,B}]]

%//ToTensorDerivative

%//InputForm

%%//FromTensorDerivative

With basis and metric :

PD[-e][V[{-a,-B}]]

%//ToTensorDerivative

%//FromTensorDerivative

T[-a,-b,-c]//ToBasis[B]

PD[-e][PD[-d][%]]

ToTensorDerivative[%]//Expand

FromTensorDerivative[%]

%//ToCanonical

InputForm[%]

DefTensor[X[-a],M]

PD[-e][Basis[-b,{a,B}]metric[b,c]X[-c]]//Expand

PD[-e][X[{a,B}]]

%//ToTensorDerivative//Expand

%//FromTensorDerivative

-X[{-d,B}]PD[-e][metric[a,b]Basis[-a,{c,B}]Basis[-b,{d,B}]]//Expand

Other derivatives

TensorD[T[a,b,c]T[-b,-c,-d],LieD[V[a]]]

%//ScreenDollarIndices//InputForm

FromTensorDerivative[%%]

%//InputForm

TensorDerivative[T,LieD[V[a]]][a,b,c]