Hi I'm using the package xAct but I'm running into an issue. It seems that before using //ChristoffelToGradMetric the christoffel connection has indices (which can be printed using FindIndices), but after using //ChristoffelToGradMetric the resulting expression is no longer recognized by mathematica as having indices. I have to use //ChristoffelToGradMetric because I need the explicit expressions in terms of the metric (I don't want to do this by hand), then I want to replace the dummy indices in this expression with TraceDummy. However, mathematica does not recognize ChristoffelCD[c,-a,-b]//ChristoffelToGradMetric as an object with indices, so I can't split the dummy indices and this is where I need your help.

Consider a manifold with a metric:

<< xAct`xTensor`
DefManifold[M, D, IndexRange[a, f]]
DefMetric[-1, G[-a, -b], CD]

Now I want to obtain the Christoffel connection in terms of the metric. To my knowledge the only way to do this is using //ChristoffelToGradMetric. However, it seems that this function makes mathematica forget the indices of ChristoffelCD[c,-a,-b]. Before using //ChristoffelToGradMetric we have,

ChristoffelCD[c, -a, -b]
FindIndices[ChristoffelCD[c, -a -b]]

with the output:


IndexList[c, -a - b]

Now when I use //ChristoffelToGradMetric and then FindIndices I get an empty list, so mathematica does not recognize the indices on the connection:

ChristoffelCD[c, -a, -b] // ChristoffelToGradMetric

with the following output:

$\frac{1}{2} G^{c f$2982} (\partial_aG_{b f$2982} + \partial_bG_{af$2982} - \partial_{f$2982}G_{ab})$


I expected FindIndices would return IndexList[c, -a, -b, f$2982, -f$2982], but it doesn't. If I plug the connection in terms of the metric in FindIndices by hand then it does work:

FindIndices[1/2 *G[c, f] *(PD[-a][G[-b, -f]] + PD[-b][G[-a, -f]] - PD[-f][G[-a, -b]])]


IndexList[c, f, -b, -f, a]

What is going on here? It is crucial for my code that mathematica recognizes the indices f$2982 as dummy indices because I want to use TraceDummy to split the f-contractions in two sums over two internal manifolds with indices (a1, b1, ...) and (a2, b2, ...). So I want to do the following:

TraceDummy[ChristoffelCD[c,-a,-b]//ChristoffelToGradMetric, f$2982 -> IndexList[a1, a2]]

which then should replace the terms involving the dummy indices f$2982 by two terms with sums over a1 and a2, e.g. for one of the three terms:

$G^{cf}\partial_fG_{ab} = G^{ca1}\partial_{a1}G_{ab} + G^{ca2}\partial_{a2}G_{ab}$

How do I achieve this?


1 Answer 1


The problem here is that FindIndices has attribute HoldFirst, and therefore by default it does not evaluate its first argument:

In[10]:= Attributes[FindIndices]
Out[10]= {HoldFirst, Protected}

To force evaluation in the first argument use Evaluate:

In[11]:= FindIndices[Evaluate[ChristoffelCD[c, -a, -b] // ChristoffelToGradMetric]]
Out[11]= xAct`xTensor`IndexList[c, f$30383, -b, -f$30383, -a]

I recommend to use IndicesOf instead of FindIndices. It is a more powerful function and does evaluate its arguments. Take for example:

In[12]:= expr = ChristoffelCD[c, -a, -b] // ChristoffelToGradMetric

Then you can compute

In[14]:= IndicesOf[][expr]
Out[14]= xAct`xTensor`IndexList[c, f$30389, -b, -f$30389, -a]

In[15]:= IndicesOf[Free][expr]
Out[15]= xAct`xTensor`IndexList[-a, -b, c]

In[16]:= IndicesOf[Dummy][expr]
Out[16]= xAct`xTensor`IndexList[-f$30389, f$30389]

In[18]:= IndicesOf[Up][expr]
Out[18]= xAct`xTensor`IndexList[c, f$30389]

In[19]:= IndicesOf[Down][expr]
Out[19]= xAct`xTensor`IndexList[-b, -f$30389, -a]

or mixtures like

In[20]:= IndicesOf[Free, Down][expr]
Out[20]= xAct`xTensor`IndexList[-a, -b]

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.