The types ac_var, nc_var, commutative, anticommutative, and noncommutative - Maple Programming Help

The types ac_var, nc_var, commutative, anticommutative, and noncommutative

 Calling Sequence type(expr, xxx)

Parameters

 expr - any algebraic expression xxx - any of: c_symbol, ac_symbol, nc_symbol, c_var, ac_var, nc_var, commutative, anticommutative, and noncommutative

Description

 • The set of type subroutines type/xxx, where xxx is as described above, return true when the expression is of the corresponding type and false otherwise. These types are available only after loading the Physics package, or after having used any of its commands with the long form. These types are of use to recognize the commutative (C), anticommutative (AC), and noncommutative (NC) character of objects concerning products.
 • There are nine types that, for efficiency reasons, are organized in three sets of tree types each, where each set is a superset of the previous others.
 – The first set includes the most basic three types c_symbol, ac_symbol, and nc_symbol, which respectively recognize the commutative, anticommutative, or noncommutative character of a symbol (typically used to represent variables).
 – The second set includes the three types c_var, ac_var, and nc_var, which respectively recognize the commutative, anticommutative, and noncommutative character of names (symbols or indexed objects) and also functions.
 CAVEAT: consider A, b, c, ... all of them either commutative or anticommutative symbols. Then indexed objects of the form A[b, ...], are considered commutative when the parity of the product A * b * ... is 1 and anticommutative otherwise; that is: commutative when there is an odd number of anticommutative variables, considering not just the indices but also the name of the indexed object. This is of relevance when computing with derivatives in jet notation.
 – The third set includes the three types commutative, anticommutative, or noncommutative to recognize the corresponding character of arbitrary Maple expressions of type algebraic.
 • The type ac_var identified var as anticommutative (AC) according to:

 if var is a symbol beginning with an AC identifier followed by a positive number or var is an indexed object or function with such a name or var is a linear operation (e.g. differentiation) on a function with such a name then true (exception made of CAVEAT above) else false

 Type type nc_var works the same way as ac_var but instead of looking for an anticommutative identifier it looks for a noncommutative identifier in the name of the functions or variables used.
 • The other three types, commutative, anticommutative, and noncommutative address a more complex task: the recognition of the C, AC, and NC character of an expression arbitrarily composed with sums, products, powers, functions, indexed objects, and constants. Note that an algebraic expression is classified here as C, AC, or NC in an exclusive manner; that is, it cannot have two of these characters at the same time. Concerning compositions of objects belonging to different classifications, the conventions adopted here are:
 • Products:

 C * AC  =  AC * C is of AC type C * NC  =  NC * C is of NC type AC * NC <> NC * AC is of NC type

 • Sums:

 C  + AC = AC + C is of NC type C  + NC = NC + C is of NC type AC + NC = NC + AC is of NC type

Examples

 > $\mathrm{with}\left(\mathrm{Physics}\right):$
 > $\mathrm{Setup}\left(\mathrm{mathematicalnotation}=\mathrm{true}\right)$
 $\left[{\mathrm{mathematicalnotation}}{=}{\mathrm{true}}\right]$ (1)

Set first an identifier for anticommutative and noncommutative variables using Setup, for example:

 > $\mathrm{Setup}\left(\mathrm{anticommutativeprefix}=\left\{Q,\mathrm{\theta }\right\},\mathrm{noncommutativeprefix}=Z\right)$
 $\left[{\mathrm{anticommutativeprefix}}{=}\left\{{Q}{,}{\mathrm{\theta }}\right\}{,}{\mathrm{noncommutativeprefix}}{=}\left\{{Z}\right\}\right]$ (2)

Consider now the list of objects

 > $\mathrm{ee}≔\left[\mathrm{\theta },Q,Q\left(\mathrm{\theta }\right),x,f\left(x\right),f\left(\mathrm{\theta },x\right),Z,Z\left(x\right),Z\left(\mathrm{\theta }\right)\right]$
 ${\mathrm{ee}}{≔}\left[{\mathrm{\theta }}{,}{Q}{,}{Q}{}\left({\mathrm{\theta }}\right){,}{x}{,}{f}{}\left({x}\right){,}{f}{}\left({\mathrm{\theta }}{,}{x}\right){,}{Z}{,}{Z}{}\left({x}\right){,}{Z}{}\left({\mathrm{\theta }}\right)\right]$ (3)

The first three are anticommutative, the next three are commutative and the last three are noncommutative:

 > $\mathrm{map}\left(\mathrm{type},\mathrm{ee},\mathrm{commutative}\right)$
 $\left[{\mathrm{false}}{,}{\mathrm{false}}{,}{\mathrm{false}}{,}{\mathrm{true}}{,}{\mathrm{true}}{,}{\mathrm{true}}{,}{\mathrm{false}}{,}{\mathrm{false}}{,}{\mathrm{false}}\right]$ (4)
 > $\mathrm{map}\left(\mathrm{type},\mathrm{ee},\mathrm{anticommutative}\right)$
 $\left[{\mathrm{true}}{,}{\mathrm{true}}{,}{\mathrm{true}}{,}{\mathrm{false}}{,}{\mathrm{false}}{,}{\mathrm{false}}{,}{\mathrm{false}}{,}{\mathrm{false}}{,}{\mathrm{false}}\right]$ (5)
 > $\mathrm{map}\left(\mathrm{type},\mathrm{ee},\mathrm{noncommutative}\right)$
 $\left[{\mathrm{false}}{,}{\mathrm{false}}{,}{\mathrm{false}}{,}{\mathrm{false}}{,}{\mathrm{false}}{,}{\mathrm{false}}{,}{\mathrm{true}}{,}{\mathrm{true}}{,}{\mathrm{true}}\right]$ (6)
 >