+1 vote

using

tr{#}::Trace.
\nabla{#}::Derivative.
{A,B}::Depends(\nabla{#}).
A::ImplicitIndex.
ex:=tr{\nabla{A} B};
untrace(_);

I want to get $B tr{\nabla{A}}$, but it's invalid. When I rewrite it to

tr{#}::Trace.
\nabla{#}::Derivative.
{A,B}::Depends(\nabla{#}).
{\nabla{#},A}::ImplicitIndex.
ex:=tr{\nabla{A B}};
product_rule(_);
untrace(_);

'product_rule' become invalid. How to get the right result? i.e. $B tr{\nabla{A}}+\nabla{B} tr{A}$

I have pushed some changes so that

\nabla{#}::Derivative;
A::ImplicitIndex;
tr{#}::Trace;
\nabla{#}::ImplicitIndex;
ex:=tr{\nabla{A B}};
product_rule(ex);

works, in the sense that it distributes the derivative properly. The problem was (and to some extent still is) that the derivative does not inherit the implicit indices properly. I need a few more fixes under the hood to make this work properly, hang on.

Ok, it works, thanks.