Polynomial Orderings

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.

MonomialList[poly]get the list of monomials
CoefficientRules[poly]represent the monomials by exponent vectors and coefficients
FromCoefficientRules[list]construct a polynomial from a list of rules

Different representations of polynomials.

Here is a polynomial in three variables.
In[1]:=
Click for copyable input
Out[1]=
This is the list of the monomials.
In[2]:=
Click for copyable input
Out[2]=
This is the list of the monomials represented as exponent vectors and coefficients.
In[3]:=
Click for copyable input
Out[3]=
The first vector corresponds to .
In[4]:=
Click for copyable input
Out[4]=
FromCoefficientRules constructs the original polynomial from the list of rules and variables.
In[5]:=
Click for copyable input
Out[5]=

If the second argument to MonomialList or CoefficientRules 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.
In[6]:=
Click for copyable input
Out[6]=
Now the first vector corresponds to .
In[7]:=
Click for copyable input
Out[7]=
In[8]:=
Click for copyable input
Out[8]=

By default, the monomials are sorted lexicographically and given in the decreasing order. In the previous example, (corresponding to ) is taken to precede (corresponding to ) by the second element.

An order is described by defining how two vectors of exponents and 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.

10.gif

Weight matrices corresponding to different orderings.

For functions such as GroebnerBasis and PolynomialReduce, 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 and Times are sorted on evaluation.
In[9]:=
Click for copyable input
Out[9]//FullForm=
This is the sorted list of terms.
In[10]:=
Click for copyable input
Out[10]=
This is the reverse lexicographic order in variables .
In[11]:=
Click for copyable input
Out[11]=
This is the same order specified by a weight matrix.
In[12]:=
Click for copyable input
Out[12]=
The result is identical to the automatically sorted list of terms in poly.
In[13]:=
Click for copyable input
Out[13]=

TraditionalForm tries to arrange the terms in an order close to the lexicographic ordering.

The polynomial displayed in TraditionalForm.
In[14]:=
Click for copyable input
Out[14]//TraditionalForm=
This uses advanced typesetting capabilities to obtain the list of terms in the same order as they appear in the TraditionalForm output.
In[15]:=
Click for copyable input
Out[15]=
The result agrees with the list of the monomials given in the default (lexicographic) order.
In[16]:=
Click for copyable input
Out[16]=

The option tells TraditionalForm which variables should be excluded from the ordering.

By default, the list of independent variables is assumed to be .
In[17]:=
Click for copyable input
Out[17]//TraditionalForm=
Here x is assumed to be the only variable.
In[18]:=
Click for copyable input
Out[18]//TraditionalForm=

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.

New to Mathematica? Find your learning path »
Have a question? Ask support »