Physics[`*`]  generalized product that operates like a commutative, anticommutative, or noncommutative product depending on the parity of its operands
Physics[`^`]  generalized exponentiation

Calling Sequence


a * b * c ...
a ^ b ...


Parameters


a, b, c, ...



arbitrary algebraic expressions that typically enter products





Description


•

When the Physics package is loaded, a more general product operator, represented by the same symbol *, is loaded. Unlike the default Maple * operator (herein called the commutative product operator), the * operator loaded with Physics does not assume commutativity of its operands and instead automatically operates like a commutative, anticommutative, or noncommutative product, depending on the corresponding commutation properties of its operands.

•

Similarly, a generalized exponentiation operator, ^, is loaded, that takes into account possible assumptions equal to 0, 1 and 1 on a and b, and handles among other things matrices, the Physics Bra and Ket commands transforming integer powers into products, the Physics Inverse command (equivalent to b = 1), and returns using the standard :`^` operator only when a and b are of type commutative, avoiding in this way what would otherwise be incorrect commutative products of noncommutative mathematical variables/expressions.

•

When computing with quantumstate vectors in Dirac notation, the Physics * operator also represents the tensor product of Bras and Kets, such as in $\A>*<B\$ (a quantum operator) or $\A>*\B>$ (a Ket of the tensor product of spaces).

•

To set the identifiers for noncommutative and anticommutative variables in the context of the Physics package, see Setup. Also, when using the Standard graphical user interface, you can set the mathematical display so that commutative, anticommutative, and noncommutative objects are displayed in different colors, which can also be customized. To set the display to mathematical notation, enter the command Setup(mathematicalnotation = true). See Setup for details.

•

In order to make zero recognition possible in the not commutative case, basic simplifications, unnesting, and sorting of arguments of these products are automatically performed. So the output of $a$*$b$ will be equal to the output of $b$*$a$ when a and/or b are commutative objects, and it will be equal to the output of $b$*$a$ when a and b are anticommutative objects. If a and b are noncommutative, then for both $a$*$b$ and $b$*$a$, the respective outputs are just the products as entered. The form automatically returned is $*$ itself, built as follows:

2.

The elements of s1 are sorted by using machine ordering (table(symmetric)), resulting in sorted_s1.

4.

Both sorted_s1 and sorted_s2 are normalized by using normal.

5.

A result is built and returned as the normalized form of sorted_s1 times sorted_s2.

•

In connection with applying a product to some arguments, as for instance in $\left(a*b\right)\left(x\right)\to \left(a\left(x\right)*b\left(x\right)\right)$, to have any of $a\left(x\right)$ or $b\left(x\right)$ returned just as $a$ or $b$, declare them first as parameters by using the Parameters command. To have only the quantum operators ($a$, $b$, or both) applied to $x$, use the `.` operator of the Physics package, as in$\left(a*b\right).x$.

•

After loading Physics, the original commutative product operator can still be invoked as the function :$\mathrm{`*`}$, as in :$ab$. However, note that it would be wrong to use :$`*`\left(...\right)$ product constructions involving noncommutative or anticommutative operands.

•

Remark: to compute the scalar product between Bras, Kets, and quantum operators defined as such by using the Setup command or returned by the Annihilation and Creation commands, use the `.` operator in the Physics package, not the * generalized multiplication operator described in this page.



Examples


>

Setup(mathematicalnotation = true);

$\left[{\mathrm{mathematicalnotation}}{=}{\mathrm{true}}\right]$
 (1) 
First, set some identifiers to work with anticommutative and noncommutative variables.
>

Setup(anticommutativeprefix = {Q, theta}, noncommutativeprefix = Z);

$\left[{\mathrm{anticommutativeprefix}}{=}\left\{{Q}{\,}{\mathrm{\theta}}\right\}{\,}{\mathrm{noncommutativeprefix}}{=}\left\{{Z}\right\}\right]$
 (2) 
So below, $a,b,c$, and $f\left(\mathrm{\theta}\right)$ are commutative, the latter contains the anticommutative object $\mathrm{\theta}$, $\mathrm{Q1}$ and $\mathrm{Q2}$ are of anticommutative type, and $\mathrm{Z1}$ is noncommutative. Use delay evaluation quotes to see the product before and after it is normalized.
>

' a * f(theta) * b * Q1 * c * Q3 * Q2 ';

${a}{}{f}{}\left({\mathrm{\theta}}\right){}{b}{}{\mathrm{Q1}}{}{c}{}{\mathrm{Q3}}{}{\mathrm{Q2}}$
 (3) 
${}{a}{}{b}{}{c}{}{f}{}\left({\mathrm{\theta}}\right){}{\mathrm{Q1}}{}{\mathrm{Q2}}{}{\mathrm{Q3}}$
 (4) 
Note that instead of using delay evaluation quotes as in the example above, you can also use the inert form of the product function, %*, to represent this product and then "perform the product" when you prefer using the value command: the differentiation and expansion rules for %* are the same as those for *.
>

`%*`(a, f(theta), b, Q1, c, Q3, Q2);

${\mathrm{\%*}}{}\left({a}{\,}{f}{}\left({\mathrm{\θ}}\right){\,}{b}{\,}{\mathrm{Q1}}{\,}{c}{\,}{\mathrm{Q3}}{\,}{\mathrm{Q2}}\right)$
 (5) 
${}{a}{}{b}{}{c}{}{f}{}\left({\mathrm{\theta}}\right){}{\mathrm{Q1}}{}{\mathrm{Q2}}{}{\mathrm{Q3}}$
 (6) 
The next example in a nested expression containing commutative, anticommutative, and noncommutative products and a sum. Due to the prefixes chosen, objects beginning with $Q$ and followed by an integer are anticommutative, and those beginning with $Z$ are noncommutative. In this example, the ${}$ symbol appears six times, nested in various ways (note the delay evaluation quotes):
>

' `*`(a, `*`(h(theta), b, `*`(Q1,Z1,Q2) * Q4) * `*`(Z3 * Q5 , c * (Q3Q6)), f(theta)) ';

${a}{}{h}{}\left({\mathrm{\theta}}\right){}{b}{}{\mathrm{Q1}}{}{\mathrm{Z1}}{}{\mathrm{Q2}}{}{\mathrm{Q4}}{}{\mathrm{Z3}}{}{\mathrm{Q5}}{}{c}{}\left({\mathrm{Q3}}{}{\mathrm{Q6}}\right){}{f}{}\left({\mathrm{\theta}}\right)$
 (7) 
A canonical representation for this product with the commutative, anticommutative, and noncommutative operands, sorted according to the itemization in the Description:
${a}{}{b}{}{c}{}{f}{}\left({\mathrm{\theta}}\right){}{h}{}\left({\mathrm{\theta}}\right){}{\mathrm{Q1}}{}{\mathrm{Q2}}{}{\mathrm{Q4}}{}{\mathrm{Q5}}{}\left({\mathrm{Q3}}{}{\mathrm{Q6}}\right){}{\mathrm{Z1}}{}{\mathrm{Z3}}$
 (8) 
The Commutator between two noncommutative objects, $\mathrm{Z1}$ and $\mathrm{Z2}$:
>

zz := Commutator(Z1, Z2);

${\mathrm{Commutator}}{}\left({\mathrm{Z1}}{\,}{\mathrm{Z2}}\right)$
 (9) 
${\mathrm{Z1}}{}{\mathrm{Z2}}{}{\mathrm{Z2}}{}{\mathrm{Z1}}$
 (10) 
The above is the difference between two * products. Applying this difference to an argument distributes the application across the operands of the * products.
${\mathrm{Z1}}{}\left({x}\right){}{\mathrm{Z2}}{}\left({x}\right){}{\mathrm{Z2}}{}\left({x}\right){}{\mathrm{Z1}}{}\left({x}\right)$
 (11) 
${\mathrm{Commutator}}{}\left({\mathrm{Z1}}{}\left({x}\right){\,}{\mathrm{Z2}}{}\left({x}\right)\right)$
 (12) 
To have, for example, $\mathrm{Z1}$ not applied to $x$ when applying the product $\mathrm{zz}$ as above, use the Parameters command.
$\left\{{\mathrm{Z1}}\right\}$
 (13) 
${\mathrm{Commutator}}{}\left({\mathrm{Z1}}{\,}{\mathrm{Z2}}{}\left({x}\right)\right)$
 (14) 
${\mathrm{Z1}}{}{\mathrm{Z2}}{}{\mathrm{Z2}}{}{\mathrm{Z1}}$
 (15) 
${\mathrm{Z1}}{}{\mathrm{Z2}}{}\left({x}\right){}{\mathrm{Z2}}{}\left({x}\right){}{\mathrm{Z1}}$
 (16) 
Set the Commutator between two quantum operators $A$ and $B$ to zero, so that $A$ and $B$ are noncommutative objects that commute between themselves.
>

Setup(mop = {A, B}, %Commutator(A, B) = 0);

$\mathrm{*\; Partial\; match\; of\; \text{'}}{}\mathrm{mop}{}\mathrm{\text{'}\; against\; keyword\; \text{'}}{}\mathrm{quantumoperators}{}\text{'}$
 
$\mathrm{\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_}$
 
$\left[{\mathrm{algebrarules}}{\=}\left\{{\mathrm{\%Commutator}}{}\left({A}{\,}{B}\right){\=}{0}\right\}{\,}{\mathrm{quantumoperators}}{\=}\left\{{A}{\,}{B}\right\}\right]$
 (17) 
Their product is not automatically normalized when taking the algebra rules set.
A canonical form would be $AB$.
You can normalize these products by using Simplify directly, which applies various simplifications. Alternatively, in order to avoid further simplifications, use the $\mathrm{algebrarules}$ restricting option, which applies only the algebra rules set.
>

Simplify((19), algebrarules);



See Also


`.`, Annihilation, Bra, Creation, diff, evalapply, Inverse, Ket, Parameters, Physics, Physics conventions, Physics examples, Physics Updates, Tensors  a complete guide, MiniCourse Computer Algebra for Physicists, Setup, Simplify, SortProducts, types: commutative, anticommutative and noncommutative

