the commutator A B - B A - Maple Help

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 $AB-BA$ and $AB+BA$, 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 $2AB$ 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.

 > $\mathrm{with}\left(\mathrm{Physics}\right):$
 > $\mathrm{Setup}\left(\mathrm{mathematicalnotation}=\mathrm{true}\right)$
 $\left[{\mathrm{mathematicalnotation}}{=}{\mathrm{true}}\right]$ (1)
 > $\mathrm{e1}≔\mathrm{%Commutator}\left({Z}_{1},{Z}_{2}\right)$
 ${\mathrm{e1}}{≔}{\left[{{Z}}_{{1}}{,}{{Z}}_{{2}}\right]}_{{-}}$ (2)

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.

 > $\mathrm{lprint}\left(\right)$
 %Commutator(Z[1], Z[2])
 > $\mathrm{e2}≔\mathrm{%AntiCommutator}\left({\mathrm{θ}}_{1},{\mathrm{θ}}_{2}\right)$
 ${\mathrm{e2}}{≔}{\left[{{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right]}_{{+}}$ (3)
 > $\mathrm{lprint}\left(\right)$
 %AntiCommutator(theta[1], theta[2])

At this point, $Z$ and $\mathrm{theta}$ are just any two commutative symbols, so by expanding or evaluating the Commutator and AntiCommutator above, you get:

 > $\mathrm{expand}\left(\mathrm{e1}\right)=\mathrm{value}\left(\mathrm{e1}\right)$
 ${0}{=}{0}$ (4)
 > $\mathrm{expand}\left(\mathrm{e2}\right)=\mathrm{value}\left(\mathrm{e2}\right)$
 ${2}{}{{\mathrm{\theta }}}_{{1}}{}{{\mathrm{\theta }}}_{{2}}{=}{2}{}{{\mathrm{\theta }}}_{{1}}{}{{\mathrm{\theta }}}_{{2}}$ (5)

Compare these results with the active forms of Commutator and AntiCommutator: (only) the automatic simplifications Commutator(A, B) -> 0 and $\mathrm{AntiCommutator}\left(A,B\right)\to 2\mathrm{AB}$, when $A$ or $B$ is commutative, are performed.

 > $\mathrm{Commutator}\left({Z}_{1},{Z}_{2}\right)$
 ${0}$ (6)
 > $\mathrm{AntiCommutator}\left({\mathrm{θ}}_{1},{\mathrm{θ}}_{2}\right)$
 ${2}{}{{\mathrm{\theta }}}_{{1}}{}{{\mathrm{\theta }}}_{{2}}$ (7)

Set $Z$ and $\mathrm{theta}$ to be the prefix of noncommutative and anticommutative variables, respectively, and compute the expanded form of $\mathrm{e1}$ and $\mathrm{e2}$ again. In this example, evaluating the operation is different from expanding; they are only equal for the Anticommutator $\mathrm{e2}$ when they result in $0$ or 2AB.

 > $\mathrm{Setup}\left(\mathrm{anticommutativeprefix}=\mathrm{θ},\mathrm{noncommutativeprefix}=Z\right)$
 $\left[{\mathrm{anticommutativeprefix}}{=}\left\{{\mathrm{_λ}}{,}{\mathrm{\theta }}\right\}{,}{\mathrm{noncommutativeprefix}}{=}\left\{{Z}\right\}\right]$ (8)
 > $\mathrm{e1}$
 ${\left[{{Z}}_{{1}}{,}{{Z}}_{{2}}\right]}_{{-}}$ (9)
 > $\mathrm{expand}\left(\right)=\mathrm{value}\left(\right)$
 ${{Z}}_{{1}}{}{{Z}}_{{2}}{-}{{Z}}_{{2}}{}{{Z}}_{{1}}{=}{\left[{{Z}}_{{1}}{,}{{Z}}_{{2}}\right]}_{{-}}$ (10)
 > $\mathrm{e2}$
 ${\left[{{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right]}_{{+}}$ (11)
 > $\mathrm{expand}\left(\right)=\mathrm{value}\left(\right)$
 ${0}{=}{0}$ (12)

Some normalization of noncommutative products is performed before returning.

 > $\mathrm{e3}≔{\mathrm{θ}}_{1}+{\mathrm{θ}}_{2}$
 ${\mathrm{e3}}{≔}{{\mathrm{\theta }}}_{{1}}{+}{{\mathrm{\theta }}}_{{2}}$ (13)
 > $\mathrm{e4}≔{\mathrm{θ}}_{1}-{\mathrm{θ}}_{2}$
 ${\mathrm{e4}}{≔}{{\mathrm{\theta }}}_{{1}}{-}{{\mathrm{\theta }}}_{{2}}$ (14)
 > $\mathrm{e5}≔\mathrm{%Commutator}\left({\mathrm{θ}}_{1}\mathrm{e3},{\mathrm{θ}}_{2}\mathrm{e4}\right)$
 ${\mathrm{e5}}{≔}{\left[{{\mathrm{\theta }}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{+}{{\mathrm{\theta }}}_{{2}}\right){,}{{\mathrm{\theta }}}_{{2}}{}\left({{\mathrm{\theta }}}_{{1}}{-}{{\mathrm{\theta }}}_{{2}}\right)\right]}_{{-}}$ (15)
 > $\mathrm{expand}\left(\mathrm{e5}\right)$
 ${0}$ (16)

Here again, the active form recognizes the zero; you can activate the inert form to see this, by using the value command.

 > $\mathrm{value}\left(\mathrm{e5}\right)$
 ${0}$ (17)

Define two quantum operators and a commutator algebra for them.

 > $\mathrm{Setup}\left(\mathrm{quantumop}=\left\{R,P\right\},\mathrm{algebrarule}=\left\{\mathrm{%Commutator}\left({R}_{j},{P}_{k}\right)=I{\mathrm{KroneckerDelta}}_{j,k}\right\}\right)$
 ${\mathrm{* Partial match of \text{'}quantumop\text{'} against keyword \text{'}quantumoperators\text{'}}}$
 ${\mathrm{* Partial match of \text{'}algebrarule\text{'} against keyword \text{'}algebrarules\text{'}}}$
 $\left[{\mathrm{algebrarules}}{=}\left\{{\left[{{R}}_{{j}}{,}{{P}}_{{k}}\right]}_{{-}}{=}{I}{}{{\mathrm{\delta }}}_{{j}{,}{k}}\right\}{,}{\mathrm{quantumoperators}}{=}\left\{{P}{,}{R}\right\}\right]$ (18)
 > $\mathrm{Commutator}\left({R}_{1},{P}_{2}\right)$
 ${0}$ (19)
 > $\mathrm{Commutator}\left({R}_{2},{P}_{2}\right)$
 ${I}$ (20)
 > $\mathrm{Commutator}\left({R}_{n},{P}_{m}\right)$
 ${I}{}{{\mathrm{\delta }}}_{{m}{,}{n}}$ (21)

With few restrictions, Commutator algebras can also be set for powers of quantum operators. Consider two conjugate operators; that is, satisfying:

 > $\mathrm{Setup}\left(\mathrm{quantumop}=\left\{Q,P\right\},\mathrm{algebrarule}=\left\{\mathrm{%Commutator}\left(Q,P\right)=I\right\}\right)$
 ${\mathrm{* Partial match of \text{'}quantumop\text{'} against keyword \text{'}quantumoperators\text{'}}}$
 ${\mathrm{* Partial match of \text{'}algebrarule\text{'} against keyword \text{'}algebrarules\text{'}}}$
 $\left[{\mathrm{algebrarules}}{=}\left\{{\left[{Q}{,}{P}\right]}_{{-}}{=}{I}{,}{\left[{{R}}_{{j}}{,}{{P}}_{{k}}\right]}_{{-}}{=}{I}{}{{\mathrm{\delta }}}_{{j}{,}{k}}\right\}{,}{\mathrm{quantumoperators}}{=}\left\{{P}{,}{Q}{,}{R}\right\}\right]$ (22)
 > $\mathrm{Commutator}\left(Q,P\right)$
 ${I}$ (23)

After setting the algebra as in the input line above, you have:

 > $\mathrm{Commutator}\left(Q,{P}^{2}\right)$
 ${2}{}{I}{}{P}$ (24)
 > $\mathrm{Commutator}\left({Q}^{2},{P}^{3}\right)$
 ${3}{}{I}{}{\left[{Q}{,}{{P}}^{{2}}\right]}_{{+}}$ (25)
 > $\mathrm{Simplify}\left(\right)$
 ${6}{}{I}{}{Q}{}{{P}}^{{2}}{+}{6}{}{P}$ (26)
 > $\mathrm{Commutator}\left(Q,{P}^{m}\right)$
 ${\left[{Q}{,}{{P}}^{{m}}\right]}_{{-}}$ (27)

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 ${P}^{m}$. For these cases, you can set a rule for the power directly that will also work when the exponent is equal to 1.

 > $\mathrm{Setup}\left(\mathrm{redo},\mathrm{algebra}=\left\{\mathrm{%Commutator}\left(Q,{P}^{m}\right)=Im{P}^{m-1}\right\}\right)$
 ${\mathrm{* Partial match of \text{'}algebra\text{'} against keyword \text{'}algebrarules\text{'}}}$
 $\left[{\mathrm{algebrarules}}{=}\left\{{\left[{Q}{,}{{P}}^{{m}}\right]}_{{-}}{=}{I}{}{m}{}{{P}}^{{m}{-}{1}}\right\}\right]$ (28)
 > $\mathrm{Commutator}\left(Q,P\right)$
 ${I}$ (29)
 > $\mathrm{Commutator}\left({Q}^{2},{P}^{3}\right)$
 ${3}{}{I}{}\left({2}{}{I}{}{P}{+}{2}{}{{P}}^{{2}}{}{Q}\right)$ (30)
 > $\mathrm{Commutator}\left({Q}^{2},{P}^{s}\right)$
 ${I}{}{s}{}\left({I}{}\left({s}{-}{1}\right){}{{P}}^{{s}{-}{2}}{+}{2}{}{{P}}^{{s}{-}{1}}{}{Q}\right)$ (31)
 >