up previous next
3.3.1 CoCoA Operators
In CoCoA there are 5 main types of operators: algebraic operators, relational operators, boolean operators, selection operators, and the range operator. There is also an n-ary operator >< for forming Cartesian products of lists and an operator :: used in defining rings.

The meaning of an operator depends on the types of its operands; the + in the expression A + B represents the sum of polynomials, or of ideals, or of matrices, etc. according to the type of A and B.

The multiplication symbol * can always be omitted. The expression F(E) is intrinsically ambiguous; it can be the variable F multiplied by the parenthesized expression E, or the application of the function F to the argument E. CoCoA always interprets this expression in the latter way. In the former case the user must separate F from the left parenthesis with a blank or an *.

The CoCoA operators are, from the highest to the lowest priority:
    []  .   (selection operators)
    ^  %
    +  -    (as unary operators)
    *  :  /
    +  -    (as binary operators)
    =  <>  <  <=  >  >=
Operations with equal priority are performed from left to right. When in doubt, parentheses may be used to enforce a particular order of evaluation.

Furthermore there is the n-ary operator >< (made by using a greater than sign > and a less than sign <) for making Cartesian products of lists (see CartesianProduct, CartesianProductList ) and the operator :: for defining rings (see New Rings and Use ).