# What is the operator **? [closed]

In mathematica if you run:

In[83]:= M = Table[Subscript[m, i], {i, 3}] ;
P = Table[Subscript[p, i], {i, 3}];
Q = Table[Subscript[q, i], {i, 3}];
fn[t1_, t2_] := #.# &[t1 P - t2 Q + M];
fnSym = fn[t1, t2]

Out[87]= (Subscript[m, 1] + t1 Subscript[p, 1] -
t2 Subscript[q, 1]) ** (Subscript[m, 1] + t1 Subscript[p, 1] -
t2 Subscript[q, 1]) + (Subscript[m, 2] + t1 Subscript[p, 2] -
t2 Subscript[q, 2]) ** (Subscript[m, 2] + t1 Subscript[p, 2] -
t2 Subscript[q, 2]) + (Subscript[m, 3] + t1 Subscript[p, 3] -
t2 Subscript[q, 3]) ** (Subscript[m, 3] + t1 Subscript[p, 3] -
t2 Subscript[q, 3])


The result contains lots of double asterisk **, which I cannot find anywhere in their operator list (http://reference.wolfram.com/language/tutorial/Operators.html)

So what does it mean?

• If you type ** into the search field of the Documentation Center, you will find that it is the operator form of NonCommutativeMultiply – m_goldberg Aug 27 '17 at 1:29
• ** won't appear in the result unless it also appeared in your input. – Szabolcs Aug 27 '17 at 10:13

Since this was missing from What are the most common pitfalls awaiting new users? I'll answer. ** is shorthand for NonCommutativeMultiply as can be seen with FullForm:

FullForm[a ** b ** c] // HoldForm

NonCommutativeMultiply[a, b, c]


Or highlight ** in the Front End and press F1, which should open a Search Results Notebook with a single entry for

NonCommutativeMultiply (Built-in Wolfram Language Symbol)
a ** b ** c is a general associative, but non-commutative, form of multiplication.

• An addition for everybody else reading: as can be ascertained from the name of the operator, it's a useful operation if you want to define non-commutative multiplication for objects you have (e.g. in the quaternion package). – J. M. will be back soon Aug 26 '17 at 22:01