Physics[Commutator] - the commutator A B - B A
Physics[AntiCommutator] - the anti-commutator A B + B A
Calling Sequence
Commutator(A, B)
AntiCommutator(A, B)
Parameters
A, B
-
any two algebraic expressions
Description
The Commutator and AntiCommutator commands represent A⁢B−B⁢A and A⁢B+B⁢A, respectively, where A and B may be non commutative objects. The output of AntiCommutator(A, B) and Commutator(A, B) is:
If A and B commute, Anticommutator returns 2⁢A⁢B and Commutator returns 0.
You can indicate the result for the Commutator or AntiCommutator by setting algebra rules.
The entered function call may return unevaluated.
The %Commutator and %AntiCommutator commands are the inert forms of Commutator and AntiCommutator; that is, they represent the same mathematical operations while displaying the operations unevaluated. To evaluate the operations, use the value or expand commands.
Commutators and AntiCommutators can also be expanded by using the expand or Physics[Expand] command. When the output is expanded, it is normalized and any repeated indices in products of tensors (defined as such by Define) are automatically simplified by the Simplify command.
Activating the inert operation by using value is the same as expanding it by using expand, except when the result of the Commutator is 0 or the result of the AntiCommutator is 2AB. Otherwise, evaluating just replaces the inert % operators by the active ones in the output.
When the Physics package is loaded, two routines for the enhanced display of unevaluated and inert Commutators and AntiCommutators are loaded together, so that Commutators are shown as a "list" of two operands, subscripted with the `-` sign. AntiCommutators are shown also as a list of two operands, subscripted with the `+` sign. In the literature, AntiCommutators are displayed as two operands inside curly brackets { }. This notation is not used in Maple to avoid potential confusion with Maple sets, displayed using curly brackets, where the order of the operators is not fixed.
Examples
As with the other commands in the Physics package, you can use the inert form, which is the command's name prefixed by the % character.
with⁡Physics:
Setup⁡mathematicalnotation=true
mathematicalnotation=true
e1≔%Commutator⁡Z1,Z2
e1≔Z1,Z2−
Note that the display above is obtained by using a `print/Commutator` routine (see print). The actual computational structure above is visible by using the lprint command.
lprint⁡
%Commutator(Z[1],Z[2])
e2≔%AntiCommutator⁡θ1,θ2
e2≔θ1,θ2+
%AntiCommutator(theta[1],theta[2])
At this point, Z and θ are just any two commutative symbols, so by expanding or evaluating the Commutator and AntiCommutator above, you get:
expand⁡e1=value⁡e1
0=0
expand⁡e2=value⁡e2
2⁢θ1⁢θ2=2⁢θ1⁢θ2
Compare these results with the active forms of Commutator and AntiCommutator: (only) the automatic simplifications Commutator(A, B) -> 0 and AntiCommutator⁡A,B→2⁢AB, when A or B is commutative, are performed.
Commutator⁡Z1,Z2
0
AntiCommutator⁡θ1,θ2
2⁢θ1⁢θ2
Set Z and θ to be the prefix of noncommutative and anticommutative variables, respectively, and compute the expanded form of e1 and e2 again. In this example, evaluating the operation is different from expanding; they are only equal for the Anticommutator e2 when they result in 0 or 2AB.
Setup⁡anticommutativeprefix=θ,noncommutativeprefix=Z
anticommutativeprefix=θ,noncommutativeprefix=Z
e1
Z1,Z2−
expand⁡=value⁡
Z1⁢Z2−Z2⁢Z1=Z1,Z2−
e2
θ1,θ2+
Some normalization of noncommutative products is performed before returning.
e3≔θ1+θ2
e4≔θ1−θ2
e5≔%Commutator⁡θ1⁢e3,θ2⁢e4
e5≔θ1⁢θ1+θ2,θ2⁢θ1−θ2−
expand⁡e5
Here again, the active form recognizes the zero; you can activate the inert form to see this, by using the value command.
value⁡e5
Define two quantum operators and a commutator algebra for them.
Setup⁡quantumop=P,R,algebrarule=%Commutator⁡Rj,Pk=I⁢KroneckerDeltaj,k
* Partial match of 'quantumop' against keyword 'quantumoperators'
* Partial match of 'algebrarule' against keyword 'algebrarules'
_______________________________________________________
algebrarules=Rj,Pk−=I⁢δj,k,quantumoperators=P,R
Commutator⁡R1,P2
Commutator⁡R2,P2
I
Commutator⁡Rn,Pm
I⁢δm,n
With few restrictions, Commutator algebras can also be set for powers of quantum operators. Consider two conjugate operators; that is, satisfying:
Setup⁡quantumop=P,Q,algebrarule=%Commutator⁡Q,P=I
algebrarules=Q,P−=I,Rj,Pk−=I⁢δj,k,quantumoperators=P,Q,R
Commutator⁡Q,P
After setting the algebra as in the input line above, you have:
Commutator⁡Q,P2
2⁢I⁢P
Commutator⁡Q2,P3
3⁢I⁢Q,P2+
Simplify⁡
6⁢I⁢Q⁢P2+6⁢P
Commutator⁡Q,Pm
Q,Pm−
So the Commutator rule set suffices to compute when the power of the operator is an integer but not when it is a symbol, as in Pm. For these cases, you can set a rule for the power directly that will also work when the exponent is equal to 1.
Setup⁡redo,algebra=%Commutator⁡Q,Pm=I⁢m⁢Pm−1
* Partial match of 'algebra' against keyword 'algebrarules'
algebrarules=Q,Pm−=I⁢m⁢Pm−1
3⁢I⁢2⁢I⁢P+2⁢P2⁢Q
Commutator⁡Q2,Ps
I⁢s⁢I⁢s−1⁢Ps−2+2⁢Ps−1⁢Q
See Also
Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists, Setup, Simplify, SortProducts, type/algebraic, type/anticommutative, type/commutative, type/noncommutative, value
Download Help Document