# What is the correct way to tell Cadabra a vector has unit norm?

0 votes

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?

asked

## 1 Answer

+1 vote

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.

answered by (61k points)

Thanks! This makes perfect sense!