Returns the class of the residue class ring of the
ring and the modulus mod.
This class is a subclass of ResidueClassRing and
has the class methods ::ground, ::modulus and [x]
, which return the fundamental ring ring, the modulus
mod and the representing residue class of x, respectively.
Example: divide the polynomial ring by the modulus x**2 + x + 1
.
require "rational"
require "polynomial"
require "residue-class-ring"
Px = Algebra.Polynomial(Rational, "x")
x = Px.var
F = ResidueClassRing(Px, x**2 + x + 1)
p F[x + 1]**100 #=> -x - 1
When ring is Integer, all inverse elements are calculated
in advance. And we can obtain the residue classes of
0, 1, ... , mod-1
by to_ary.
Example: the prime field of modulo 7
require "residue-class-ring"
F7 = Algebra::ResidueClassRing.create(Integer, 7)
a, b, c, d, e, f, g = F7
p [e + c, e - c, e * c, e * 2001, 3 + c, 1/c, 1/c * c]
#=> [6, 2, 1, 3, 5, 4, 1]
p( (1...7).collect{|i| F7[i]**6} )
#=> [1, 1, 1, 1, 1, 1]