sort_product
Sort factors in a product
Sort factors in a product, taking into account
any SortOrder
properties. Also takes into account
commutativity properties, such as SelfCommuting
. If no sort
order is given, it first does a lexographical sort based on the name
of the factor, and if two names are identical, does a sort based on
the number of children and (if this number is equal) a lexographical
comparison of the names of the children. Symbols starting with a backslash
(greek letters etc.) get sorted to the right of roman letters.
The simplest sort is illustrated below,ex := C B A D;
sort_product(_);
CBAD
ABCD
We can declare the objects to be anti-commuting, which then leads to
{A, B, C, D}::AntiCommuting.
ex := C B A D;
sort_product(_);
CBAD
−ABCD
For indexed objects, the anti-commutativity of components is indicated
using the
SelfAntiCommuting
property,\psi_{m}::SelfAntiCommuting.
ex := \psi_{n} \psi_{m} \psi_{p};
sort_product(_);
ψnψmψp
−ψmψnψp
Finally, the lexographical sort order can be overridden by using
the
SortOrder
property,{D, C, B, A}::SortOrder.
{A, B, C, D}::AntiCommuting.
ex := C B A D;
sort_product(_);
CBAD
−DCBA