Physics[Expand] - expand noncommutative products over sums, Commutators, Brackets, etc.
Calling Sequence
Expand(expr)
Parameters
expr
-
any expression
Description
The Expand command expands powers and distributes products over sums, where the products can be expressed with the * and ^ operators in the Physics package, or with the commutative (:-*, :-^) or inert (%*, %^) versions of them. Expand also expands the Commutator and AntiCommutator functions of the Physics package, Brackets and Inverse of products. The products resulting from these expansions are all returned normalized using Normal.
After the Physics package has been loaded, the functionality provided by Expand is also automatically provided through the standard expand command. However expand additionally expands mathematical functions, something that Expand does not do.
Note: For the conventions adopted to represent noncommutative and anticommutative objects, see Setup and the types anticommutative and noncommutative.
Examples
with⁡Physics:
Setup⁡mathematicalnotation=true
mathematicalnotation=true
For illustration purposes, first set θ and Q as prefixes to identify anticommutative variables and functions, and Z to identify noncommutative ones (see Setup for details).
Setup⁡anticommutativeprefix=Q,θ,noncommutativeprefix=Z
anticommutativeprefix=Q,θ,noncommutativeprefix=Z
Consider now the noncommutative product between anticommutative objects and related sums.
Q1⁢Q1+Q3⁢Q4+Q5⁢Q6
You can get the expanded form of this product using expand or Expand:
Expand⁡
Q1⁢Q3⁢Q4⁢Q6+Q1⁢Q3⁢Q5⁢Q6
Note that in the expanded representation, all * products are distributed. The following is a more complicated example, involving anticommutative and noncommutative objects.
a⁢h⁡θ+b⁢Q1⁢Z1⁢Q2⁢Q4+Z3⁢Q5⁢c⁢Q3−Q6⁢f⁡θ
a⁢h⁡θ+b⁢Q1⁢Q2⁢Q4⁢Z1+c⁢f⁡θ⁢Q5⁢Q3−Q6⁢Z3
h⁡θ⁢Q1⁢Q2⁢Q4⁢Z1⁢a+b⁢Q1⁢Q2⁢Q4⁢Z1⁢a−f⁡θ⁢Q3⁢Q5⁢Z3⁢c−f⁡θ⁢Q5⁢Q6⁢Z3⁢c
Now you can use the usual Maple commands to manipulate this expression. For example, note the existence of common factors entering the commutative products of this expression; you can take advantage of them to simplify it.
convert⁡,horner
h⁡θ⁢Q1⁢Q2⁢Q4⁢Z1+b⁢Q1⁢Q2⁢Q4⁢Z1⁢a+−f⁡θ⁢Q3⁢Q5⁢Z3−f⁡θ⁢Q5⁢Q6⁢Z3⁢c
To additionally expand also the mathematical functions, use expand instead of Expand; compare for instance these two results:
Z3⁢Q5⁢c⁢Q3−Q6⁢cos⁡a+b
c⁢cos⁡a+b⁢Q5⁢Q3−Q6⁢Z3
−c⁢cos⁡a+b⁢Q3⁢Q5⁢Z3−c⁢cos⁡a+b⁢Q5⁢Q6⁢Z3
expand⁡
−c⁢cos⁡a⁢cos⁡b⁢Q3⁢Q5⁢Z3−c⁢cos⁡a⁢cos⁡b⁢Q5⁢Q6⁢Z3+c⁢sin⁡a⁢sin⁡b⁢Q3⁢Q5⁢Z3+c⁢sin⁡a⁢sin⁡b⁢Q5⁢Q6⁢Z3
Expansion of Brackets over sums happen automatically but for inert Brackets you can use Expand
Setup⁡quantumoperators=A,B
quantumoperators=A,B
%Bracket⁡Bra⁡φ,a⁢A+b⁢B+c,Ket⁡ψ
φ|a⁢A+b⁢B+c|ψ
a⁢φ|A|ψ+b⁢φ|B|ψ+c⁢φ|ψ
See Also
convert/horner, Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists, Physics[*], Physics[^], Setup
Download Help Document