Raising/Lowering dummy indices to obtain cancellations

27 views
Skip to first unread message

Richard Kleeman

unread,
Apr 30, 2026, 12:02:12 PM (7 days ago) Apr 30
to xAct Tensor Computer Algebra
I am new to xAct and am using it at present to perform a Legendre transform on the GR EM Lagrangian to get the ADM Hamiltonian form. As you can see from the attached notebook on the final line of output (apart from the undefines) the final form after using ToCanonical and Simplify contains multiple terms which will cancel if dummy indices are reversed in their upper and lower positions in some of the terms. Is there a way of making xTensor do this dummy index repositioning? ToCanonical doesn't seem to be doing this...
thirdtry.nb

Juan Margalef

unread,
Apr 30, 2026, 5:21:14 PM (7 days ago) Apr 30
to xAct Tensor Computer Algebra
You have to use ContracMetric:

expr /. ARules // ContractMetric // Simplification

A few additional comments:

1. Be careful, you are writing ^{-1} which creates a list. Compare:

2^(-2)
2^{-2}
2^{-2,-1}

2. Instead of the substitutions rules you have used, it is safer to use MakeRule:

FRules = MakeRule[{F0[i], gr[i] - ADOT[i]}]
ARules = MakeRule[{ADOT[i],  gr[i] + Shift[-s] F[s, i] +   Lapse[] \!\(TraditionalForm\`\[CapitalPi]\)[i] Gam[]^(-1)}]

3. Instead of 0.25, you can write 1/4 to avoid the 1. that you see in your result.


Richard Kleeman

unread,
May 1, 2026, 10:59:53 AM (6 days ago) May 1
to xAct Tensor Computer Algebra
That worked thanks!
Reply all
Reply to author
Forward
0 new messages