# Levi-Civita tensor for ccgrg Mathematica package

I'm just learning to use the ccgrg package for computing Riemann curvatures etc in Mathematica. The package has most of the useful geometric tensors as built-in functions, but I can't find a function for obtaining the Hodge dual of a tensor, or equivalently the Levi-Civita tensor. Is there one?

Mathematica itself has a function LeviCivitaTensor[d] built in, but it uses the indices in a different manner than ccgrg (and seems to be the Levi-Civita symbol rather than the tensor as it misses the $$\sqrt{|g|}$$ that is required of a general-coordinate tensor). Converting the way the entries are referenced looks rather indirect and inelegent.

Any suggestions?

Added comment: I think I have found a nasty bug in the ccgrg package. I tried computing $$R^{ijmn}R_{ijmn}$$ for the Kerr metric by evaluating

Sum[tRiemannR[i,j,m,n]tRiemannR[-i,-j,-m,-n]
,{i,dim},{j,dim},{m,dim},{n,dim}]


as illustrated in the documentation in arXiv:1603.05819 eq 11. It did not get the correct answer. With the ccgrg convention, the indices are summed frm 1 to 4. I noticed that the incorrect answer no longer depended on the mass parameter $$m$$ however. A bit of digging shows that $$m$$ was everywhere replaced by the number 4. It seems that the way they re-implement the mathematica "Sum" function replaces the $$m$$ in the expressions with the last value (here 4) of the dummy summation index $$m$$ in "Sum". i.e. the summation variables are not private to the subroutine that uses them. This is a bit off-putting. I don't think that the regular Sum[expression, {m,1,4}] does this.

• Re. your last expression: shouldn't the period be a comma? – AccidentalFourierTransform Mar 9 '18 at 16:31
• @AccidentalFourierTransform. Yes. A typo in the post only. What I evaluated had a proper comma. – mike stone Mar 9 '18 at 18:22

The conflict of variables for the Kerr spacetime, you mentioned, is of the type

Sum[{a, b, c, d}[[a]], {a, 4}]


1 + b + c + d

This is an internal conflict of arguments of Sum. Basically, this is possible to define in ccgrg some additional functions, to prevent conflicts like that, but any prevention cost the evaluation time. So, we would rather leave this to users' responsibility. You are right - some warning notes about that should be in the package.

Antisymmetric tensor is denoted by:

\ [Eta] \ [DoubleDagger].

The code in the package is a bit different, but what it essentially does for covariant components is

etacov[a_, b__] := Sign[metricDet] Sqrt[Sign[metricDet] metricDet] Signature[{a, b}];

and then is extended to contravariant and mixed components in the standard way. Since etacov is defined as function of variable number of argumets, so is \ [Eta] \ [DoubleDagger]. This number is in no way related to the space dimension (yet!). Be carefull.

• Thanks a ton! I've figured out how to work around my original Sum problem. Nw I'll play with the Eta dagger-dagger tensor and the etacov. It's a great package. – mike stone Mar 11 '18 at 18:43