# How to define commutative covariant derivatives in xTensor

I'm new with working xAct package and got stuck defining covariant derivatives that commute with each other.

I want to simulate flat space-time. And here is my code

DefManifold[M4, 4, IndexRange[{a, f}]];
DefCovD[CD[-a], TangentM4, {"|", "\[Del]"}, Curvature -> False, CurvatureRelations -> False]
DefTensor[T[a], M4]


The following expression should be equal to zero because there is no curvature and in flat space, covariant derivatives are the normal commutative derivatives. But it does not commute

CD[c]@CD[b]@T[a] - CD[b]@CD[c]@T[a] // Simplification


What am I doing wrong?

Covariant derivatives with upper indices do not make sense before introducing a metric. So this works:

In[7]:= CD[-c]@CD[-b]@T[a] - CD[-b]@CD[-c]@T[a] // Simplification
Out[7]= 0


Instead of Simplification (or ToCanonical) you can also use SortCovDs, which will sort covariant derivatives even if they are not flat, introducing Riemann terms.

You can automate sorting of a covariant derivative with

In[8]:= SortCovDsStart[CD]


Then you have:

In[9]:= CD[-c]@CD[-b]@T[a] - CD[-b]@CD[-c]@T[a]
Out[9]= 0

• I've defined metric like this now DefMetric[-1, g[-a, -b], CD, {"|", "\[Del]"}, FlatMetric -> True] But Covariant derivatives with upper indices still does not commute Commented Jul 27, 2019 at 5:26