[Next] [Prev] [Right] [Left] [Up] [Index] [Root]
Comparison

Comparison

The comparison of two objects in Magma is generally performed with the following binary operators:

eq
equal to
ne
not equal to
gt
greater than
ge
greater than or equal to
lt
less than
le
less than or equal to

Each of them returns true or false .

Elements can be compared for equality/inequality only when they are of suitable types and Magma can find a common overstructure. Note that

The tests such as `gt' only apply when there is an ordering defined on the parent magma of the elements. For such magmas, the maximum and minimum of a pair, set or sequence of elements may also be calculated, with the functions Maximum and Minimum (or Max and Min).

Example

> print 10*10 eq 100;
true

> P<x>:=PolynomialRing(RationalField()); > print (x^6 + 3*x^4) lt (2*x - 5);

>> print (x^6 + 3*x^4) lt (2*x - 5); ^ Runtime error in 'lt': Bad argument types > print Degree(x^6 + 3*x^4) lt Degree(2*x - 5); true

[Next] [Prev] [Right] [Left] [Up] [Index] [Root]