5.22 QuotientRemainder

QuotientRemainder( r, m )
QuotientRemainder( R, r, m )

In the first form QuotientRemainder returns the Euclidean quotient and the Euclidean remainder of the ring elements r and m in their default ring as pair of ring elements. In the second form QuotientRemainder returns the Euclidean quotient and the Euclidean remainder of the ring elements r and m in the ring R. The ring R must be a Euclidean ring (see IsEuclideanRing) otherwise an error is signalled.

A ring R is called a Euclidean ring, if it is an integral ring, and there exists a function delta, called the Euclidean degree, from R-{0_R} to the nonnegative integers, such that for every pair r in R and s in R-{0_R} there exists an element q such that either r - q s = 0_R or delta(r - q s) < delta( s ). The existence of this division with remainder implies that the Euclidean algorithm can be applied to compute a greatest common divisors of two elements, which in turn implies that R is a unique factorization ring. QuotientRemainder returns this quotient q and the remainder r - q s.

    gap> qr := QuotientRemainder( 16, 3 );
    [ 5, 1 ]
    gap> 3 * qr[1] + qr[2]; 
    16
    gap> QuotientRemainder( Integers, 201, 11 );
    [ 18, 3 ] 

QuotientRemainder calls R.operations.QuotientRemainder( R, r, m ) and returns the value.

The default function called this way is RingOps.QuotientRemainder, which just signals an error, because there is no default function to compute the Euclidean quotient or remainder of one ring element modulo another. Thus Euclidean rings must overlay this default function with other functions.

Previous Up Top Next
Index

GAP 3.4.4
April 1997