By default, an expression like NoncommutativeMultiply[x] does not simplify to x, unlike Times[x] or Plus[x]. My attempts to implement an automatic replacement e.g.:
Unprotect[NonCommutativeMultiply];
NonCommutativeMultiply /: NonCommutativeMultiply[x_] := x;
Protect[NonCommutativeMultiply];
tend to go into infinite loops e.g. when typing x**y. I understand why this is the case for a function like NonCommutativeMultiply with attribute Flat. However, I have been unable to find a way to overcome this behaviour and obtain replacements like for Plus and Times.
Similarly, I also cannot find a way to automatically replace NonCommutativeMultiply[] with 1 without causing infinite loops (again, Plus and Times work fine giving 0 and 1, respectively).
Any help would be greatly appreciated.
OneIdentityperhaps? – AccidentalFourierTransform Jun 01 '18 at 01:58