Physics[SortProducts] - sort the operands of the products of a given expression according to an indicated ordering
|
Calling Sequence
|
|
SortProducts(ee, ordering, {totheleft, totheright, useanticommutator, usecommutator, useinert})
|
|
Parameters
|
|
ee
|
-
|
any algebraic expressions containing products with non-commutative operands, or any valid Maple object containing such expressions
|
ordering
|
-
|
a list indicating the desired ordering for (some or all of) the operands in the products in ee
|
totheleft = ...
|
-
|
optional, can be true, false, or the string "not given" (default). It indicates where the desired ordering of the operands in products should be placed: to the left when true, to the right when false, or in place when "not given"
|
totheright = ...
|
-
|
optional, can be true, false, or the string "not given" (default). It indicates where the desired ordering of the operands should be placed: to the right when true, to the left when false, or in place when "not given"
|
useanticommutator = ...
|
-
|
optional, can be true, false, or the string "not given" (default). It forces reordering any two product operands that do not commute, by using A*B = - B*A + AntiCommutator(A, B), even if the value of AntiCommutator(A, B) is not known to the system.
|
usecommutator = ...
|
-
|
optional, can be true, false, or the string "not given" (default). It forces reordering any two product operands that do not commute, by using A*B = B*A + Commutator(A, B), even if the value of Commutator(A, B) is not known to the system.
|
useinert = ...
|
-
|
optional, can be true, false, or the string "not given" (default). It forces using the inert forms %Commutator and %AntiCommutator regardless of whether the value of the corresponding Commutator and AntiCommutator is known to the system.
|
|
|
|
|
Description
|
|
•
|
SortProducts receives an expression involving products and sorts the operands of these products according to the ordering indicated as the second argument, a list containing some or all of the operands of the product. The sorting of operands performed automatically takes into account any algebra rules set using Setup.
|
•
|
By default, the sorting between two operands A and B is performed when the value of their Commutator or AntiCommutator is known to the system (can be resolved). Note that if a Commutator can be resolved, so is the AntiCommutator and viceversa. To have the sorting performed even when the Commutator cannot be resolved, use the options usecommutator or useanticommutator, in which case the output will respectively contain an unresolved (unevaluated) Commutator or AntiCommutator. The options usecommutator and useanticommutator cannot be used simultaneously.
|
•
|
When the options usecommutator or useanticommutator are used, commutators or anticommutators introduced by SortProducts will be expressed using the active Commutator and AntiCommutator commands unless the operands of these commutators or anticommutators involve products, in which case they will be represented using the inert %Commutator or %AntiCommutator commands. This has the purpose of allowing for further manipulations of the output without having these commutators introduced by SortProducts automatically expanded by the corresponding active command (for details on this automatic expansion, see Commutator).
|
•
|
To override that default behavior, you can pass the optional argument useinert, or useinert = true. In that case, all the Commutators and AntiCommutators introduced by SortProducts will be expressed using the inert commands %Commutator or %AntiCommutator, regardless of whether these commutators can be resolved.
|
•
|
Equivalently, passing useinert = false all the Commutators and AntiCommutators introduced by SortProducts will be expressed in active form, using the Commutator or AntiCommutator commands, regardless of whether their operands involve products, in which case their expansion will be automatically performed as explained in the help page for Commutator.
|
•
|
SortProducts sorts the operands of the products 'in place', optionally positioning, when possible, the sorted operands to the left or to the right of the unsorted operands, when respectively passing the optional arguments totheleft or totheright. The option totheright cannot be used simultaneously with either of usecommutator and useanticommutator; so when using this option the sorting of say A and B is performed only if their Commutator can be resolved.
|
•
|
SortProducts is relevant mainly to sort the operands in noncommutative products expressed using the Physics:-`*` product operator, although it can also sort the operands in commutative products expressed with Maple's standard product operator, *. Note that the sorting of operands in commutative products within a sum may be reverted by the Maple kernel.
|
|
|
Examples
|
|
Consider the product of the commutative
Reorder the operands and "in place".
Sort the operands and and put them to the left, then to the right
Set a prefix identifying noncommutative variables and related algebra rules for some of them, such that and commute between themselves, but none of them commute with .
Sort Z2 and Z3 "in place".
The value of the commutator between Z1 and Z5 is not known to the system, so by default they are not sorted:
Force their sorting using their commutator or anticommutator
Enter the product of with at the end (so, to the right of P) and sort it with to the left. This is a case where does not commute with any of the other operands. Compare the results with and without the option usecommutator,
Note, in the last two examples, the introduction of an inert commutator, displayed with its brackets in grey, using the %Commutator command. You can activate those inert computations using value, in which case that commutator will be expanded because one of its operands is a product:
The input to SortProducts doesn't need to be a product, it could be any algebraic expression, in which case all its products will be sorted. For example,
Set an algebra rule for the commutator of and , for example:
The result above got computed using the algebra rule set. In some cases, however, instead of the value of the commutator (algebra rule), it is preferred the actual commutator, unevaluated. For these purposes pass the useinert option
Equivalently, when the value of the commutator is not known to the system and there are products in the operands of the commutators introduced, instead of the default inert representations one may prefer an active representation using the Commutator or AntiCommutator commands. For that purpose pass the option useinert = false
|
|
See Also
|
|
AntiCommutator, Commutator, Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists, Physics[*], Setup, type,commutative
|
|
Compatibility
|
|
•
|
The Physics[SortProducts] command was introduced in Maple 2019.
|
|
|