Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
+1 vote

I am doing some calculations on classical fields.

When expressions like $$k_i k_i k_\beta k_\beta$$ appear, I wish to simplify them using the assumption that $$k_i k_i = 1$$.

However, when I try do so the following way, the dummy index label seems to confuse Cadabra:

a:= k_i k_i k_{\beta} k_{\beta};
N:= k_i k_i = 1;
substitute(a,N);

Output:

$$k_\beta k_\beta$$

I am using the jupyter kernel installed via conda, on OSX. Is this the intended behaviour? Am I doing something wrong?

in General questions by

1 Answer

+2 votes
 
Best answer

Yes, that's expected; most algorithms will only do 'one step at a time'. If you want to apply the substitution for all matches in one shot, use the repeat=True flag, so

a:= k_i k_i k_{\beta} k_{\beta};
N:= k_i k_i = 1;
substitute(a,N, repeat=True);

An alternative is to use a converge block, though for this example that's overkill. In essence, a converge block will apply a series of instructions until the expression no longer changes. For your case,

a:= k_i k_i k_{\beta} k_{\beta};
N:= k_i k_i = 1;
converge(a):
   substitute(a,N)
;

Both of these will produce the intended '1' as result.

by (82.5k points)

Thanks! This makes perfect sense!

...