# Contraction of indices in equations

+3 votes

Hi! I am new to Cadabra and faced the following issue with contraction of indices.

Define a metric in dimension N as follows

N::Integer;
{i,j}::Indices(vector);
{i,j}::Integer(1..N);
g_{i j}::Metric;
g^{i j}::InverseMetric;
g_{i}^{j}::KroneckerDelta;

Now, if I run

_:= g_{i}^{i}:
eliminate_kronecker(_);

the output is (as expected) N

On the other hand, if I set up an equation, it appears not to work.

_:= N = g_{i}^{i}:
eliminate_kronecker(_);

In this case, the output is

N=g_{i}^{i}

and the contraction is not simplified on the right hand side of the equation.

Any help will be appreciated!

## 1 Answer

+2 votes

Best answer

That's a bug, thanks for reporting it. Try

_:= N = g_{i}^{i} + 1
eliminate_kronecker(_);

It's the edge-case of a single term with a single factor on the rhs which is not handled correctly. Will fix.

by (66.2k points)
selected by

Now fixed on github.