NonCommutativeMultiply (**)
Usage
Notes
Further Examples
Multiplication is a commutative operation.
In[1]:=
|
Out[1]=
|
But the noncommutative operator ** does not have this property.
In[2]:=
|
Out[2]=
|
You can use NonCommutativeMultiply to represent composition in an algebra of differential operators. DOperator[L, expr] applies the differential operator L, written as a pure function, to the expression expr. The base case, where A is a function, simply multiplies by A.
In[3]:=
|
The next two properties express linearity.
In[4]:=
|
In[5]:=
|
Here the operator is D. HoldPattern stops the derivative from acting on the double blank.
In[6]:=
|
Here a composition of operators is applied to expr.
In[7]:=
|
Finally a power of an operator is applied to expr.
In[8]:=
|
The commutator of L1 and L2 measures how close L1 and L2 are to commuting.
In[9]:=
|
Here is a simple example using these rules.
In[10]:=
|
In[11]:=
|
In[12]:=
|
Out[12]=
|
Here is another example.
In[13]:=
|
In[14]:=
|
In[15]:=
|
Out[15]=
|
In[16]:=
|
|