I am trying to create products following an anti-commutative rules using the binary operator **
. I define my rules the following way:
before___ ** a_ ** b_ ** after___ :>
If[OrderedQ[{a, b}] == True,
before ** a ** b ** after,
before ** ((-1)*b) ** a ** after],
NonCommutativeMultiply[x_] :> x
This does half the job that I want, since it transforms the following expression
$$o_{1,2}\text{**}o_{1,3}\text{**}o_{2,3}-o_{1,2}\text{**}o_{2,3}\text{**}o_{1,3}-o_{1,3}\text{**}o_{1,2}\text{**}o_{2,3}+o_{1,3}\text{**}o_{2,3}\text{**}o_{1,2}+o_{2,3}\text{**}o_{1,2}\text{**}o_{1,3}-o_{2,3}\text{**}o_{1,3}\text{**}o_{1,2}$$
into
$$2 o_{1,2}\text{**}o_{1,3}\text{**}o_{2,3}-2 o_{1,2}\text{**}o_{2,3}\text{**}o_{1,3}+2 o_{1,3}\text{**}o_{2,3}\text{**}o_{1,2}$$
I ultimately want to reduce the expression to
$$ 6 o_{1,2}\text{**}o_{1,3}\text{**}o_{2,3}$$
(Please add the appropriate tags for this question as I didn't find anything I deem suitable).
InputForm
) that can be copy-pasted, rather than a LaTex rendering. $\endgroup$If[cond == True, ...]
$\to$If[cond, ...]
. $\endgroup$