I have objects wrapped with head fv. So they are things like
fv[{1, 2}, {3, 4}, {5, 6}]
I then defined two operators, a
and ad
that act on these objects and spit back new objects, also with head fv:
a[v /; Head[v] == fv] = ... object returned that looks like fv[{1,2},{3, 4} ...];
ad[v /; Head[v] == fv] = ... object returned that looks like fv[{4, 5}, {6, 7} ...];
op[a] * fv[y_] ^:= a[fv[y]];
op[ad] * fv[y_] ^:= ad[fv[y]];
So now I can evaluate expressions like op[a]*fv[{1, 2}, {3, 4}]
.
I now want to also be able to evaluate expressions like op[a]**op[ad]*fv[{1, 2}, {3, 4}]
where the **
denotes non-commutative multiplication. When I try implementing this with
op[a] ** op[ad]*fv[y_] ^:= a[ad[fv[y]]];
Mathematica tells me that NonCommutativeMultiply
is protected. How should I go about doing this?