I have defined a non-commutative product:
ClearAll[M];
M[a___, b_ + c_, d___] := M[a, b, d] + M[a, c, d];
M[a___, 1, b___] := M[a, b];
M[a___, b_. c_, d___] :=
c M[a, b, d] /; FreeQ[c, R | t];
SetAttributes[M, Flat];
I would like to define an analogue of the usual Product
function, in which I would input
NewProduct[Subscript[t, i], {i, 1, n}]
which outputs, for say n = 3
,
M[Subscript[t, 1], Subscript[t, 2], Subscript[t, 3]]
Any advice would be much appreciated.