IsCommutativeRing( R )
IsCommutativeRing returns true if the ring R
is commutative and false otherwise.
A ring R is called commutative if for all elements r and s of R we have r s = s r.
gap> IsCommutativeRing( Integers );
true
IsCommutativeRing first tests whether the flag R.isCommutativeRing
is bound. If the flag is bound, it returns this value. Otherwise it calls
R.operations.IsCommutativeRing( R ),
remembers the returned value in R.isCommutativeRing,
and returns it.
The default function called this way is RingOps.IsCommutativeRing,
which tests whether all the generators commute if the component R.generators
is bound, and tests whether all elements commute otherwise, unless R
is infinite. This function is seldom overlaid, because most rings already
have the flag bound.