The below is likely a duplicate of this bug: Action of sort_product depends on the choice of index. I'm posting this separately because I can elaborate a bit on the original error, and I have simplified the minimal failing example. Tested on Cadabra 2.3.9 (build 2823). (It works fine in Cadabra v1.)
The following code should return zero but doesn't, instead just returning the input.
{a,b,c,d,e,f,g}::Indices(vector,position=independent).
ex := x_{a} x^{b} - x^{b} x_{a};
sort_product(_);
It appears to be a complicated error requiring three ingredients:
- The flag position=independent must be set. It works fine with position=free.
- The two tensors must have identical names. It works fine if they are different. The tensors must also have the same total number of indices. (If x^b becomes x^{b c}, it evaluates correctly.) Presumably this is related to them being nominally "identical".
- The indices must be in opposite positions.