Help with doing computations in xCoba

41 views
Skip to first unread message

Alejandro Aguilar

unread,
Mar 19, 2026, 12:31:33 PM (14 days ago) Mar 19
to xAct Tensor Computer Algebra
Hi everyone,
I have been trying to do some computations with xCoba but I'm not sure I'm doing it correctly. As an example, I have successfully calculated the Pontryagin density, defined as {}^*RR=\varepsilon^{cdmn}R^{a}{}_{bmn}R^{b}{}_{acd}on a slowly rotating black hole spacetime.

This seems to work if I use the code
1/2 epsilongg[a, b, c, d] RiemannCD[-e, f, -a, -b] RiemannCD[-f,e, -c, -d] /. epsilonToetaUp[gg, Kerr] //SeparateMetric[gg] // SeparateMetric[gg] // ToBasis[Kerr] // ToBasis[Kerr] // CovDToChristoffel // TraceBasisDummy // ComponentArray // ToValues // ToValues // TruncateToOrder[#, aa, expansionOrder] & // FullSimplify

I tried doing the same calculation defining CTensors of the Dual Riemann and Riemann tensors instead, when I do this my code looks like
DualRiemannCtensor[-f, e, a, b] RiemannCTensor[-e, f, -a, -b] //ToBasis[Kerr] // ToBasis[Kerr] // CovDToChristoffel //TraceBasisDummy // ComponentArray // ToValues // ToValues //TruncateToOrder[#, aa, expansionOrder] & // FullSimplify

However this seems to yield a different result and I'm not sure what's going wrong. 

The reason I'm doing it in this way is because later on I want to calculate things like

$\frac{\alpha}{2\kappa}\nabla_f \nabla_c \Phi\Big(g_{ah}\varepsilon^{hcde}R^f{}_{bde}+g_{bh}\varepsilon^{hcde}R^f{}_{ade} \Big)$,

However this is not computing using the first method, and my computer crashes because the Dual Riemann has many abstract components, I have done the calculation by defining it as CTensors, however I'm not sure I can trust them since they don't seem to recover the result for the Pontryagin density.

If someone could have a look at my code and tell me if there are better ways of doing it, it would be really helpful. The bits I am interested in are in the Test 1 and Test 2 sections in the notebook I'm attaching.

Cheers,
Alejandro

Slow Roll Kerr dCS.nb

Jose

unread,
Mar 22, 2026, 7:18:21 PM (11 days ago) Mar 22
to xAct Tensor Computer Algebra
Hi Alejandro,

I suspect there is some inconsistency somewhere about the use of upper/lower components. Instead of trying to find what the problem is, it takes me less time to rewrite the computation in a simpler way, using only CTensor objects. See attached notebook. Note in particular how I compute the Riemann tensor with the function RiemannDown, which computes Riemann with indices -a, -b, -c, -d, instead of the default -a, -b, -c, d that Riemann uses. xCoba is able to correct this difference by itself, but if we start computing the most appropriate thing, then all subsequent computations will be faster.

Note I extended a bit your function TruncateToOrder to be able to perform truncations inside CTensor. I also changed component indices to use 0..3 instead of your 1..4 original. I think it's easier to read that way.

Cheers,
Jose.
Slow Roll Kerr dCS.nb
Reply all
Reply to author
Forward
0 new messages