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

I can't get the trace of a Kronecker delta to give me 4.

With all the usual index declarations, etc,...

\delta_{\mu}^{\nu}::KroneckerDelta.
\delta^{\mu}_{\nu}::KroneckerDelta.

Z := Z = \delta^\mu_\mu;
eliminate_kronecker(Z);
canonicalise(Z);

gives back only Z = \delta^\mu_\mu; I would have expected it to give Z = 4.

Have I done something wrong?

in Bug reports by (460 points)

1 Answer

0 votes

Cadabra does not automatically assume that the dimension of space-time is 4. So you have to declare the range of the indices. If you do

{\mu,\nu}::Indices.
{\mu,\nu}::Integer(0..3).
\delta^{\mu}_{\nu}::KroneckerDelta.

Z := Z = \delta^\mu_\mu;
eliminate_kronecker(Z);

you get Z=4 as expected.

by (82.6k points)
...