I'm working on a metric-affine theory where the affine connection is independent of the metric. I've solved the general connection in terms of Levi-Civita connection of the metric plus a vector field and a constant. I want to define Christoffel tensor and change curvature from general affine Ricci to Levi-Civita Ricci. When evaluated, I get dollar indices and HeadOfTensors in the last output. The code I'm using is

$PrePrint = ScreenDollarIndices;
DefManifold[M4, 4, {a, b, c, d, e, f, i, j, k, l}]
DefCovD[Cd[-a], SymbolOfCovD -> {";", "\[Del]"}]
DefMetric[-1, g[-a, -b], Cdm, 
    SymbolOfCovD -> {":", "\!\(\*OverscriptBox[\(\[Del]\), \(~\)]\)"}, 
    PrintAs -> "g"]
DefNiceConstantSymbol["c", #] & /@ Range[2]
Christoffel[Cd, Cdm][a, -b, -c]
DefTensor[v[a], M4]
DefTensor[hMet[-a, -b], M4, Symmetric[{1, 2}], PrintAs -> "h"]
AutomaticRules[v, MakeRule[{v[a]*v[-a], -1}]]
AutomaticRules[v, MakeRule[{v[a] Cdm[-b]@v[-a], 0}]]
    MakeRule[{v[a] Cdm[-b]@Cdm[-c]@v[-a], -Cdm[-b]@v[a]*Cdm[-c]@v[-a]}]]

hMet /: hMet[a_, b_] hMet[-a_, c_] := hMet[b, c];
hMet /: hMet[a_, b_] hMet[c_, -a_] := hMet[b, c];
hMet /: hMet[b_, a_] hMet[-a_, c_] := hMet[b, c];
hMet /: hMet[b_, a_] hMet[c_, -a_] := hMet[b, c];

hMet[a_Symbol, -b_Symbol] := delta[a, -b];
hMet[-a_Symbol, b_Symbol] := delta[-a, b];
hMet[-a_Symbol, -b_Symbol] := g[-a, -b] + c1 v[-a] v[-b];
hMet[a_Symbol, b_Symbol] := g[a, b] - c1/(1 - c1) v[a] v[b];

ChristoffelCdCdm[a_Symbol, -b_Symbol, -c_Symbol] := 
    Module[{l},1/2 hMet[a,l] (Cdm[-b]@hMet[-c, -l] + Cdm[-c]@hMet[-l, -b]         
 - Cdm[-l]@hMet[-b, -c])]

ChangeCurvature[RicciCd[-a, -b], Cd, Cdm]

I've tried almost everything within my "limited" knowledge still couldn't solve the problem.


1 Answer 1


Replace your last two lines by

rule = IndexRule[ChristoffelCdCdm[a_Symbol, -b_Symbol, -c_Symbol], 1/2 hMet[a, l] (Cdm[-b]@hMet[-c, -l] + Cdm[-c]@hMet[-l, -b] - Cdm[-l]@hMet[-b, -c])]

ChangeCurvature[RicciCd[-a, -b], Cd, Cdm] /. rule

In this way you can still do abstract computations with the tensor ChristoffelCdCdm, and replace the rule whenever needed.

It seems you are working with two metrics, the original g[-a, -b] and then hMet[-a, -b]. xTensor assumes that all indices can be raised and lowered with the "first metric", in this case g. Hence hMet[a, -b] is equivalent to g[a, c] hMet[-c, -b], for example. This may be inconsistent with some of your other definitions. I'd recommend to declare hMet with DefMetric as well. Then you will have hMet and its inverse InvhMet as different tensors, not related by raising and lowering of indices, i.e. not related by multiplication with the metric g.

  • 1
    $\begingroup$ Works like a charm because I wanted to see christoffel tensor in the expressions when I needed to. Thank you very much Jose. $\endgroup$
    – C.Samaner
    Commented Feb 14, 2019 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.