>

$\mathrm{with}\left(\mathrm{Groebner}\right)\:$

>

$f\u22545{x}^{3}y+{x}^{2}{w}^{2}t+5{x}^{3}yzt2xz{w}^{3}t+3{y}^{2}{w}^{3}t$

${f}{\u2254}{}{2}{}{x}{}{z}{}{{w}}^{{3}}{}{t}{+}{3}{}{{y}}^{{2}}{}{{w}}^{{3}}{}{t}{+}{5}{}{{x}}^{{3}}{}{y}{}{z}{}{t}{+}{{x}}^{{2}}{}{{w}}^{{2}}{}{t}{+}{5}{}{{x}}^{{3}}{}{y}$
 (1) 
We first consider lexicographic order with x > y > z > w > t. The terms of f can be ordered by Maple's sort command.
>

$\mathrm{sort}\left(f\,\left[x\,y\,z\,w\,t\right]\,\mathrm{plex}\right)$

${5}{}{{x}}^{{3}}{}{y}{}{z}{}{t}{+}{5}{}{{x}}^{{3}}{}{y}{+}{{x}}^{{2}}{}{{w}}^{{2}}{}{t}{}{2}{}{x}{}{z}{}{{w}}^{{3}}{}{t}{+}{3}{}{{y}}^{{2}}{}{{w}}^{{3}}{}{t}$
 (2) 
The LeadingTerm command returns the sequence (leading monomial, leading coefficient). To construct the actual term we multiply its output using `*`.
>

$\mathrm{LeadingTerm}\left(f\,\mathrm{plex}\left(x\,y\,z\,w\,t\right)\right)$

${5}{}{{x}}^{{3}}{}{y}{}{z}{}{t}$
 (3) 
There are two ways of computing the smallest term with respect to a monomial order. One is to use the "reverse variant" and compute the leading term. We can also use the TrailingTerm command.
>

$\mathrm{TrailingTerm}\left(f\,\mathrm{plex}\left(x\,y\,z\,w\,t\right)\right)$

${3}{}{{y}}^{{2}}{}{{w}}^{{3}}{}{t}$
 (4) 
>

$\mathrm{LeadingTerm}\left(f\,\mathrm{plex\_min}\left(x\,y\,z\,w\,t\right)\right)$

${3}{}{{y}}^{{2}}{}{{w}}^{{3}}{}{t}$
 (5) 
Next we consider graded lexicographic order with x > y > z > w > t. Terms are compared first by their total degree, with ties broken by lexicographic order. This is the default order for Maple's sort command.
>

$\mathrm{sort}\left(f\,\left[x\,y\,z\,w\,t\right]\right)$

${5}{}{{x}}^{{3}}{}{y}{}{z}{}{t}{}{2}{}{x}{}{z}{}{{w}}^{{3}}{}{t}{+}{3}{}{{y}}^{{2}}{}{{w}}^{{3}}{}{t}{+}{{x}}^{{2}}{}{{w}}^{{2}}{}{t}{+}{5}{}{{x}}^{{3}}{}{y}$
 (6) 
>

$\mathrm{LeadingTerm}\left(f\,\mathrm{grlex}\left(x\,y\,z\,w\,t\right)\right)$

${5}{}{{x}}^{{3}}{}{y}{}{z}{}{t}$
 (7) 
>

$\mathrm{TrailingTerm}\left(f\,\mathrm{grlex}\left(x\,y\,z\,w\,t\right)\right)$

${5}{}{{x}}^{{3}}{}{y}$
 (8) 
We can examine the terms of maximal degree using the InitialForm command. All but two terms have total degree 6.
>

$\mathrm{initf}\u2254\mathrm{InitialForm}\left(f\,\mathrm{grlex}\left(x\,y\,z\,w\,t\right)\right)$

${\mathrm{initf}}{\u2254}{}{2}{}{x}{}{z}{}{{w}}^{{3}}{}{t}{+}{3}{}{{y}}^{{2}}{}{{w}}^{{3}}{}{t}{+}{5}{}{{x}}^{{3}}{}{y}{}{z}{}{t}$
 (9) 
${{x}}^{{2}}{}{{w}}^{{2}}{}{t}{+}{5}{}{{x}}^{{3}}{}{y}$
 (10) 
Here are the terms of f sorted in (ascending) gradedreverse lexicographic order. Among the last three terms, ties are broken by smallest degree in t, then w, and finally z before the order of the monomials is determined.
>

$\mathrm{sort}\left(\left[\mathrm{op}\left(f\right)\right]\,\left(a\,b\right)\mapsto \mathrm{TestOrder}\left(a\,b\,\mathrm{tdeg}\left(x\,y\,z\,w\,t\right)\right)\right)$

$\left[{5}{}{{x}}^{{3}}{}{y}{\,}{{x}}^{{2}}{}{{w}}^{{2}}{}{t}{\,}{}{2}{}{x}{}{z}{}{{w}}^{{3}}{}{t}{\,}{3}{}{{y}}^{{2}}{}{{w}}^{{3}}{}{t}{\,}{5}{}{{x}}^{{3}}{}{y}{}{z}{}{t}\right]$
 (11) 
In the elimination order below, we compare monomials first using tdeg(x,y) with ties broken by tdeg(z,w,t). In a Groebner basis computation using this order, the variables {x,y} would be eliminated as much as possible from the polynomial system.
>

$\mathrm{sort}\left(\left[\mathrm{op}\left(f\right)\right]\,\left(a\,b\right)\mapsto \mathrm{TestOrder}\left(a\,b\,\mathrm{lexdeg}\left(\left[x\,y\right]\,\left[z\,w\,t\right]\right)\right)\right)$

$\left[{}{2}{}{x}{}{z}{}{{w}}^{{3}}{}{t}{\,}{3}{}{{y}}^{{2}}{}{{w}}^{{3}}{}{t}{\,}{{x}}^{{2}}{}{{w}}^{{2}}{}{t}{\,}{5}{}{{x}}^{{3}}{}{y}{\,}{5}{}{{x}}^{{3}}{}{y}{}{z}{}{t}\right]$
 (12) 
Next we consider a weighted degree order. Each power of x counts for two, while each power of y counts for one half. The remaining variables count for one.
>

$\mathrm{LeadingTerm}\left(f\,\mathrm{wdeg}\left(\left[2\,\frac{1}{2}\,1\,1\,1\right]\,\left[x\,y\,z\,w\,t\right]\right)\right)$

${5}{}{{x}}^{{3}}{}{y}{}{z}{}{t}$
 (13) 
>

$\mathrm{WeightedDegree}\left(f\,\left[2\,\frac{1}{2}\,1\,1\,1\right]\,\left[x\,y\,z\,w\,t\right]\right)$

All of the builtin orders have representations as matrix orders. We will represent graded reverse lexicographic order as a matrix order and compute the leading term of f.
>

$M\u2254\mathrm{MatrixOrder}\left(\mathrm{tdeg}\left(x\,y\,z\,w\,t\right)\,\left[x\,y\,z\,w\,t\right]\right)$

${M}{\u2254}\left[\left[{1}{\,}{1}{\,}{1}{\,}{1}{\,}{1}\right]{\,}\left[{0}{\,}{0}{\,}{0}{\,}{0}{\,}{\mathrm{1}}\right]{\,}\left[{0}{\,}{0}{\,}{0}{\,}{\mathrm{1}}{\,}{0}\right]{\,}\left[{0}{\,}{0}{\,}{\mathrm{1}}{\,}{0}{\,}{0}\right]{\,}\left[{0}{\,}{\mathrm{1}}{\,}{0}{\,}{0}{\,}{0}\right]\right]$
 (15) 
>

$\mathrm{Matrix}\left(M\right)$

$\left[\begin{array}{ccccc}{1}& {1}& {1}& {1}& {1}\\ {0}& {0}& {0}& {0}& {\mathrm{1}}\\ {0}& {0}& {0}& {\mathrm{1}}& {0}\\ {0}& {0}& {\mathrm{1}}& {0}& {0}\\ {0}& {\mathrm{1}}& {0}& {0}& {0}\end{array}\right]$
 (16) 
>

$\mathrm{LeadingTerm}\left(f\,'\mathrm{matrix}'\left(M\,\left[x\,y\,z\,w\,t\right]\right)\right)$

${5}{}{{x}}^{{3}}{}{y}{}{z}{}{t}$
 (17) 
For examples of multivariate polynomial division see Groebner[NormalForm]. To compute Groebner bases, use the Groebner[Basis] command. To define monomial orders other than the ones on this page, see Groebner[MonomialOrder].