The ring Z/mZ consists of representatives for the residue classes of integers modulo m > 1. This online help node and the nodes below it describe the operations in Magma for such rings and their elements.
Sometimes it is convenient to perform certain modular operations on integers without explicitly creating the appropriate residue class rings -- the possibilities for doing so are described at the end of the section on the Ring of Integers.
At any stage during a session, Magma will have at most one copy of Z/mZ present, for any m>1; that is, different names for the same residue class ring will n facd be different references to copies of the same structure. This saves memory space, and avoids confusion about different but isomorphic structures.
If m is a prime number, the ring Z/mZ forms a field; however,
Magma has special functions for dealing with finite fields.
The operations described here should not be used for
finite field calculations: the implementation of finite field
arithmetic in Magma
takes full advantage of the special structure of finite fields
and leads to superior performance.
Coercion
Automatic coercion takes place between Z/mZ and Z so that a binary operation like + applied to an element of Z/mZ and an integer will result in a residue class from Z/mZ.
Using !, elements from a prime field GF(p) can be coerced into Z/pZ, and elements from Z/pZ can be coerced into GF(p^r). Also, transitions between Z/mZ and Z/nZ can be done with ! provided that m divides n or n divides m. In cases where there is a choice -- such as when an element r from Z/mZ is coerced into Z/nZ with m dividing n -- the result will be the residue class containing the representative for r.
> r := ResidueClassRing(3) ! 5; > r; 2 > ResidueClassRing(6) ! r; 2So the representative 2 of 5 mod 3 is mapped to the residue class 2 mod 6, and not to 5 mod 6.
Ring homomorphisms with domain Z/mZ are completely determined
by the image of 1. As usual,
we require our homomorphisms to map 1 to 1. Therefore, the general
homomorphism constructor with domain Z/mZ takes no arguments.
hom< R -> S | > : RngIntRes, Rng -> Map
Given a residue class ring R, and a ring S, create a homomorphism from R to S, determined by f(1_R) = 1_S. Note that it is the responsibility of the user that the map defines a homomorphism![Next] [Prev] [Right] [____] [Up] [Index] [Root]