Mathematica 教程 函数 »|教程 »| 更多关于 »

# 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.
 Out[1]=
This is the list of the monomials.
 Out[2]=
This is the list of the monomials represented as exponent vectors and coefficients.
 Out[3]=
The first vector corresponds to x5 y4z2.
 Out[4]=
FromCoefficientRules constructs the original polynomial from the list of rules and variables.
 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.
 Out[6]=
Now the first vector corresponds to y5 z4x.
 Out[7]=
 Out[8]=
By default the monomials are sorted lexicographically and given in the decreasing order. In the previous example, {5, 4, 1} (corresponding to y5 z4x) is taken to precede {5, 3, 2} (corresponding to y5 z3x2) by the second element.
An order is described by defining how two vectors of exponents {1, ..., n}, {1, ..., n} are sorted. For the lexicographic order,
{1, ..., n}>{1, ..., n}i, 1≤in (11...i-1i-1i>i).
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.
Negative lexicographic(
 -1 ... -1
)
Degree lexicographic(
 1 ... 1 1 1 ... 1
)
Degree reverse lexicographic(
 1 1 ... 1 -1 ... -1
)
Negative degree lexicographic(
 -1 ... -1 -1 1 ... 1
)
Negative degree reverse lexicographic(
 -1 -1 ... -1 -1 ... -1
)

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.
 Out[9]//FullForm=
This is the sorted list of terms.
 Out[10]=
This is the reverse lexicographic order in variables {x, y, z}.
 Out[11]=
This is the same order specified by a weight matrix.
 Out[12]=
The result is identical to the automatically sorted list of terms in poly.
 Out[13]=
TraditionalForm tries to arrange the terms in an order close to the lexicographic ordering.