19.5 Comparisons of Polynomials

f = g
f < g

The equality operator = evaluates to true if the polynomials f and g are equal, and to false otherwise. The inequality operator < evaluates to true if the polynomials f and g are not equal, and to false otherwise.

Note that polynomials are equal if and only if their coefficients and their base rings are equal. Polynomials can also be compared with objects of other types. Of course they are never equal.

    gap> f := Polynomial( GF(5^3), [1,2,3]*Z(5)^0 );
    Z(5)^3*X(GF(5^3))^2 + Z(5)*X(GF(5^3)) + Z(5)^0
    gap> x := Indeterminate(GF(25));;
    gap> g := 3*x^2 + 2*x + 1;
    Z(5)^3*X(GF(5^2))^2 + Z(5)*X(GF(5^2)) + Z(5)^0
    gap> f = g;
    false
    gap> x^0 = Z(25)^0;
    false

f < g
f <= g
f g
f = g

The operators <, <=, , and = evaluate to true if the polynomial f is less than, less than or equal to, greater than, or greater than or equal to the polynomial g, and to false otherwise.

A polynomial f is less than g if v(<f>) is less than v(<g>), or if v(<f>) and v(<g>) are equal and d(<f>) is less than d(<g>). If v(<f>) is equal to v(<g>) and d(<f>) is equal to d(<g>) the coefficient lists of f and g are compared.

    gap> x := Indeterminate(Integers);; x.name := "x";;
    gap> (1 + x^2 + x^3)*x^3 < (2 + x^2 + x^3);
    false
    gap> (1 + x^2 + x^4) < (2 + x^2 + x^3);    
    false
    gap> (1 + x^2 + x^3) < (2 + x^2 + x^3);
    true

Previous Up Top Next
Index

GAP 3.4.4
April 1997