The leading term of a polynomial can be chosen in many different ways. For multivariate polynomials, sorting by the total degree of the monomials is often useful.
Different representations of polynomials.
Here is a polynomial in three variables.
This is the list of the monomials.
This is the list of the monomials represented as exponent vectors and coefficients.
The first vector corresponds to
If the second argument to MonomialList
is omitted, the variables are taken in the order in which they are returned by the function Variables
The list of the variables is not always sorted.
Now the first vector corresponds to
By default, the monomials are sorted lexicographically and given in the decreasing order. In the previous example,
) is taken to precede
) by the second element.
An order is described by defining how two vectors of exponents
are sorted. For the lexicographic order,
An order can also be described by giving a weight matrix. In that case the exponent vectors are multiplied by the weight matrix and the results are sorted lexicographically, also in the decreasing order. The matrices for different orderings are given as follows.
Weight matrices corresponding to different orderings.
For functions such as GroebnerBasis
, it is necessary that the order be well-founded, which ensures that any decreasing sequence of elements is finite (the elements being the vectors of non-negative exponents). In order for that condition to hold, the first nonzero value in each column of the weight matrix must be positive.
The default sorting used for polynomial terms in an expression corresponds to the negative lexicographic ordering with variables sorted in the reversed order. This is commonly known as reverse lexicographic ordering.
This is the internal representation of a polynomial. The arguments of Plus
are sorted on evaluation.
This is the sorted list of terms.
This is the reverse lexicographic order in variables
This is the same order specified by a weight matrix.
The result is identical to the automatically sorted list of terms in poly
tries to arrange the terms in an order close to the lexicographic ordering.
This uses advanced typesetting capabilities to obtain the list of terms in the same order as they appear in the TraditionalForm
The result agrees with the list of the monomials given in the default (lexicographic) order.
which variables should be excluded from the ordering.
By default, the list of independent variables is assumed to be
is assumed to be the only variable.
One can obtain additional orderings from the six orderings used in MonomialList
simply by reversing the resulting list. This is effectively equivalent to negating the exponent vectors. In a commutative setting, one can also obtain other orderings by reversing the order of the variables.
This diagram illustrates the relations between various orderings. Red lines indicate reversing the list of variables and blue lines indicate negating the power vectors.