Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
+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

in General questions by (320 points)

1 Answer

0 votes
 
Best answer

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);
\nabla{#}::Derivative;
_:= \nabla^{i}{v_{i}} - 2 \nabla_{i}{v^{i}} ;
canonicalise(_);

does the trick.

by (66.3k points)
selected by
...