Metric manipulation

xCoba examples with Kerr-Newman

July 2011

Exit

MetricCompute

Load the system :

<<xAct`xCoba`

Setup. Deactivate info messages, both in xTensor and xCoba:

$DefInfoQ=False;
$CVVerbose=False;

Hide away ugly dummies :

$PrePrint=ScreenDollarIndices;

Report timings over 0.1 seconds:

<<xAct`ShowTime1`

$ShowTimeThreshold=0.1

In xCoba, as in all of xAct, we need to start by declaring a geometric environment.

Declare 4-manifold :

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

Declare abstract metric :

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

Declare Boyer-Lindquist chart :

DefChart[B,M,{0,1,2,3},{t[],r[],θ[],ϕ[]}]

Now we specify components of the metric in that chart. First, declare the Kerr-Newman constants:

DefConstantSymbol[Mass,PrintAs->"M"]
DefConstantSymbol[Rotation,PrintAs->"a"]
DefConstantSymbol[Charge,PrintAs->"Q"]

Input the metric. Note that coordinates are fields, and hence need a pair of brackets.

Delta=r[]^2+Rotation^2+Charge^2-2Mass r[];
Sigma=r[]^2+Rotation^2Cos[θ[]]^2;
MatrixForm[KerrMetric={
{-(Delta-Rotation^2Sin[θ[]]^2)/Sigma,0,0,-Rotation Sin[θ[]]^2(r[]^2+Rotation^2-Delta)/Sigma},
{0,Sigma/Delta,0,0},
{0,0,Sigma,0},
{-Rotation Sin[θ[]]^2(r[]^2+Rotation^2-Delta)/Sigma,0,0,((r[]^2+Rotation^2)^2-Delta Rotation^2Sin[θ[]]^2)/Sigma Sin[θ[]]^2}
}]

We use the function MetricInBasis to input the components of the metric in a given basis. It is a rather flexible function :

?MetricInBasis

We simply pass the components matrix as third argument. Note the minus sign in front of B. This indicates that we are supplying the covariant components of the metric.

MetricInBasis[metric,-B,KerrMetric]

TensorValues[metric]

Now we compute a particular object. We can choose, with the option CVSimplify, the function which is used on all (independent) components after each step of the computation. The algorithm reports timings and sizes in memory.
To see the possible values for the third argument simply write the symbol All there. Note the structure string[1,-1,...] , where -1 means covariant and 1 means contravariant.

?MetricCompute

MetricCompute[metric,B,"Riemann"[-1,-1,-1,-1],CVSimplify->Simplify]

Most of the time is spent in the simplification of the tensor components.

Now we have the independent components :

Last@TensorValues[RiemannCD]//Column

We can compute other objects. The previously computed objects are repeated, but much faster because Mathematica has cached the results. THIS IS NOT WORKING NOW.

MetricCompute[metric,B,"Kretschmann"[],CVSimplify->Simplify]

MetricCompute[metric,B,"Kretschmann"[],CVSimplify->Simplify]

KretschmannCD[]//ToValues

%//InputForm

FullSimplify[%]

Collect[#,Charge,Simplify]&/@%

We can also compute "everything" :

MetricCompute[metric,B,All,CVSimplify->Simplify]

MetricCompute[metric,B,All,CVSimplify->Simplify]

In particular now we have as well

DetmetricB[]//ToValues

Check of the contracted Bianchi identity :

CD[-c][EinsteinCD[-a,-b]]//ToBasis[B]//ToBasis[B]

%metric[{c,B},{b,B}]//Expand

array=%//TraceBasisDummy//ComponentArray//Expand

Length/@%

array//ToValues//Simplify

Three ways to handle components

In xCoba there are three ways to manipulate components. We explain this using our metric as an example:

1) The data is internally stored as a collection of rules, called tensor-values, using the data structure FoldedRule. (This FoldedRule has been defined in the package xCore). There are two lists of rules: the first contains the dependent  values and the second one contains the independent  values.

TensorValues[metric]

Hence we can easily separate dependent and independent components :

Column/@List@@Map[First,%,{2}]

Emphasis: This structure avoids keeping several copies of the same value in symmetry-related components.

2) We can also easily generate an array of abstract components:

ComponentArray[metric[-{a,B},-{b,B}]]

or using the alternative (but slightly slower) notation

TableOfComponents[metric[-a,-b],B]

We can replace the values we know (folded rules can be used as other types of rules):

%/.TensorValues[metric]//MatrixForm

The function ToValues is able to figure out which components can be replaced by its stored values :

%%//ToValues//MatrixForm

Emphasis : Simplicity. Once all tensor values are given as an array, there are lots of Mathematica functions which can be used to manipulate them, say finding eigenvalues:

Eigenvalues[%]

3) We can also give an abstract expression for the metric :

abstractmetric[-a_,-b_]=metric[-a,-b]//SeparateBasis[B]//TraceBasisDummy//ToValues

From this expression we can go back to an array:

Coefficient[%,BasisArray[B][-a,-b]]

or to a set of rules :

MapThread[Rule,{TableOfComponents[metric[-a,-b],B],%},2]

Emphasis : The geometric character of the tensors. Now we can perform any kind of geometric operation, without reference to the chart/basis we are using. For instance, show that we indeed have a symmetric object:

abstractmetric[-a,-b]-abstractmetric[-b,-a]

Summarizing, components can be manipulated using sets of rules (and this is how they are internally stored in xCoba), using arrays of components (simpler, but with unavoidable repetitions), or using abstract expressions (more flexible, but slower).

The use of tensor-values can be automatized, avoiding a continuous use of ToValues, and also making computations faster, because values are replaced as soon as possible. This is done as follows :

RuleToSet[metric]

Now :

ComponentArray[metric[-{a,B},-{b,B}]]//MatrixForm

To avoid corruption, the tensor-values are shielded against evaluation using HoldPattern, though only in the left-hand-side.

TensorValues[metric]

If you want to do any modification, then you need to go back to the Rule state.

SetToRule[metric]

TensorValues[metric]