sign changed index splitting

Hello

At first, thank you for inventing this very good tools

i wondering is there other way to split index

if i use split_index command to split index m to \mu and 5,

i get

A^{m} B_{m} = A^{\mu} B_{\mu} + A^{5} A_{5}


but

i want this to be

A^{m} B_{m} = A^{\mu} B_{\mu} - A^{5} A_{5}


Is there any good way?

Thank you

+1 vote

In Cadabra the Einstein index summation convention always means just a plain sum, without sign factors. Did you really mean those indices to one upper, one lower? Or does this sign come from a suppressed metric?

+1 vote

With the version of Cadabra currently on github (2.3.1.5) you can write a small function which examines every term in the expression, counts the number of '5' indices, and flips the sign if there is an odd number of pairs. Starting from

{m,n,p}::Indices(space);
{\mu,\nu}::Indices(subspace, parent=space);
ex:=A^{m n} B_{m n};
split_index(ex, $m, \mu, 5$, repeat=True);


which produces $$A^{\mu \nu} B_{\mu \nu}+A^{\mu 5} B_{\mu 5}+A^{5 \mu} B_{5 \mu}+A^{5 5} B_{5 5},$$ you can define

def flip5(ex):
for node in ex:
for term in node.terms():
cnt=0
for index in term.indices():
if index.name=="1" and index.multiplier==5:
cnt+=1
term.multiplier *= (-1)**(cnt//2)
return ex


and then do

flip5(ex);


to get $$A^{\mu \nu} B_{\mu \nu}-A^{\mu 5} B_{\mu 5}-A^{5 \mu} B_{5 \mu}+A^{5 5} B_{5 5}$$