# Contractions in derivatives

+1 vote

Hi! When I run the following code, Cadabra gives me ConsistencyException: Free indices in different terms in a sum do not match.

{i,j,k}::Indices(vector);
N::Integer;
{i,j,k}::Integer(1..N);

_:= \nabla^{i}{v_{i}} - 2 \nabla_{i}{v^{i}} ;
canonicalise(_);

Is something wrong with the code? Substituting

 substitute(_, $\nabla^{i}{v_{i}} -> \nabla_{i}{v^{i}}$)

did not help. Can I force Cadabra to combine the two terms in another way?

Many thanks! Andreas

Cadabra does not make any assumptions about the symbol you use for the derivative. You need to explicitly declare \nabla to be a derivative:
{i,j,k}::Indices(vector);
canonicalise(_);