# making a rule for converting from partial to covariant derivative

43 views

### Anupam Ah

Feb 21, 2023, 7:31:09 AMFeb 21
to xAct Tensor Computer Algebra
Hi,

I am interested in converting a expression that contains partial derivatives and i need to convert that covariant derivatives and christoffel symbols w.r.t a metric which i have defined in the beginning of the code. Suppose i need to convert the expr

\partial_{a}V_{b} to \nabla_{a}V_{b} + \Gamma^c_{a b} V_{c}, where \partial denotes the partial derivative , \nabla denotes the covariant derivative and \Gamma denotes the respective Christoffel symbol. Can you help me how to implement this in xact. I tried the following,

vectorptoc = IndexRule[PD[-a_][expr_[-b_]] , cd[-a][expr[-b]]  - Christoffelcd[c, -a, -b] expr[-c]]

where expr_ denotes any vector , but this rule was giving me a error that found inhomogeneous indices.

### Sergi Sirera-Lahoz

Feb 24, 2023, 8:44:44 AMFeb 24
to xAct Tensor Computer Algebra
Hi Anupam,

As far as I know, you don't need to be explicit in introducing the Christoffel symbols in the rule yourself. That should be automatically included in the covariant derivative if it's acting on a vector/tensor. Maybe you could try this:

vectorptoc = {PD[-aa_][expr_[-bb_]] -> cd[-aa][expr[-bb]]}

or, more generally

pdTocd =  {PD[-aa_][XX_] -> cd[-aa][XX]}

Not sure if this will help but it doesn't hurt trying. Also, make sure it's fine for you to do that (as you know pd and cd are not the same for a vector!).

Best,

Sergi

### Jose

Feb 28, 2023, 8:26:18 PMFeb 28
to xAct Tensor Computer Algebra
Hi,

The command ChangeCovD[expr, covd1, covd2] changes the covd1 derivatives into the covd2 derivatives, introducing appropriate Christoffel tensors. Both covd1 and covd2 can be PD. For example, suppose this setup:

<<xActxTensor
\$PrePrint = ScreenDollarIndices;
DefManifold[M, 4, {a, b, c, d, e}]
DefTensor[v[a], M]
DefMetric[-1, g[-a, -b], cd]

Then take an expression like this:

PD[-a][v[b]] + v[-a] v[b]

You can change PD to CD using

ChangeCovD[%, PD, cd]

Cheers,
Jose.