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

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Physics : type/commutative

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


Calling Sequence




Calling Sequence

type(expr, xxx)




any algebraic expression



any of: c_symbol, ac_symbol, nc_symbol, c_var, ac_var, nc_var, commutative, anticommutative, and noncommutative



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:



C * AC  =  AC * C

is of AC type

C * NC  =  NC * C

is of NC type

AC * NC <> NC * AC

is of NC type



C  + AC = AC + C

is of NC type

C  + NC = NC + C

is of NC type

AC + NC = NC + AC

is of NC type






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




Consider now the list of objects




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










See Also



Physics conventions

Physics examples




Download Help Document

Was this information helpful?

Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam