Possible bug in xPert?

46 views
Skip to first unread message

James Kwon

unread,
Nov 8, 2025, 1:35:56 AMNov 8
to xAct Tensor Computer Algebra
Hello, 

In the lines below, I take Lie derivatives of the perturbed Sqrt[-Detg[]]. The following two lines are giving me different results, which should give me the same result as the top. The difference is whether I put ExpandPerturbation before or after LieDToCovD. Is this a possible bug? 

ToCanonical[
 ContractMetric[
   LieDToCovD[
    ExpandPerturbation@LieD[v[a]][Perturbation[Sqrt[-Detg[]], 1]], CD]]/
  Sqrt[-Detg[]]]

ToCanonical[
 ContractMetric[
   ExpandPerturbation@
    LieDToCovD[LieD[v[a]][Perturbation[Sqrt[-Detg[]], 1]], CD]]/
  Sqrt[-Detg[]]]

Thank you!
bug_question.nb

Juan Margalef

unread,
Dec 8, 2025, 12:14:23 PMDec 8
to xAct Tensor Computer Algebra
Hi James,

I think you have found a bug but not in xPert, but in LieD[v,CovD] when acting on densities (it might be intentional in xAct, but if so, I don't understand why). First, a couple of comments to identify the problem:

1. If you change your argument Sqrt[-Detg[]] for Detg[], you can see that the difference is related to the WeightOf your argument (in your case, Sqrt[-Detg[]] is a density of Weight 1, while Detg[] is a density of Weight 2).

2. If you change CD for PD:

   ToCanonical[ ContractMetric[   LieDToCovD[    ExpandPerturbation@LieD[v[a]][Perturbation[Sqrt[-Detg[]], 1]], PD]]/  Sqrt[-Detg[]]]
   ToCanonical[ ContractMetric[   ExpandPerturbation@    LieDToCovD[LieD[v[a]][Perturbation[Sqrt[-Detg[]], 1]], PD]]/  Sqrt[-Detg[]]]

The results are equal.

My two cents:

In theory, LieDToCovD[expr,CD] changes all LieD[vector] for LieD[vector,CD]. However, computing these commands (which seem equivalent):

  LieD[v[a], CD][Detg[]] 
  LieD[v[a]][Detg[]] // LieDToCovD[#, CD] & // ContractMetric


return 0 (wrong if I understood that command correctly) and 2*the-divergence (correct). Looking into the code of xTensor, LieD uses WeightOf[Detg[], WeightedWithBasis[CD]] (which is zero) instead of WeightOf[Detg[]] (which is 2AIndex). I am sure it has its logic but I lack the knowledge to understand why (I will try to understand better WeightedWithBasis and densities in general within xAct). That makes that the density is not taken into account and the expression is zero, since CD@metric=0. The question is, why the second expression is not zero? Because LieD[v[a]][Detg[]] is automatically replaced by its expression in terms of L_v[metric] BEFORE getting to LieDToCovD (which then acts on the tensor metric, not on the density) and then everything works as intended.

There is a note in the code:

2) If a second argument is supplied then the Lie derivative is expanded. QUESTION: Is it correct for the density case? Somehow the result should depend on the basis associated to the density, and not only to the metric of the Levi-Civita connection. I'm not even sure whether the Lie derivative must see the density character of an expression... QUESTION: And what happens with basis indices? Currently we are only expanding abstract indices, through the use of vb`Q functions.

so this has been thought about but I do not follow the reasoning. Maybe someone with more experienced can chip in. In any case, there is clearly an inconsistency which I think needs a careful consideration.

I hope this helps and we can figure out how to solve the inconsistency!

Best,
Juan Margalef
Reply all
Reply to author
Forward
0 new messages