Consider the following code:
MatchQ[Cycles[{{1, 2}}] ** (Cycles[{{1, 2}}]),
NonCommutativeMultiply[a___, Cycles[x_], Plus[y__], b___]]
There is no plus there, how can this be true?
Thanks
Consider the following code:
MatchQ[Cycles[{{1, 2}}] ** (Cycles[{{1, 2}}]),
NonCommutativeMultiply[a___, Cycles[x_], Plus[y__], b___]]
There is no plus there, how can this be true?
Thanks
If Plus is given a single argument it just returns the argument.
In[1]:= Plus[3]
Out[1]= 3
So if the single argument is a pattern, the unchanged pattern will be returned.
Therefore:
In[2]:= MatchQ[u*w, Times[a_, Plus[b_]]]
Out[2]= True