(剰余環クラス)
環からその1つの元を法とした剰余環を構成します。実際のクラスを生成するには環 と法とを指定して、クラスメソッド ResidueClassRing.create あるいは 関数 ResidueClassRing を用います。
なし
ResidueClassRing(ring, mod)
ResidueClassRing.create(ring, mod) と同じです。
AlgebraicExtentionField(field, obj){|x| ... }
体 field を、obj で表される変数 x の多項式
...
で拡大した環を返します。この環には、変数 x で
代表される剰余類を返すクラスメソッドvarが定義されます。
例: 有理数を方程式 x**2 + x + 1 == 0
で拡大した体 F を作る。
require "rational" require "polynomial" require "residue-class-ring" F = AlgebraicExtentionField(Rational, "x") {|x| x**2 + x + 1} x = F.var p( (x-1)** 3 / (x**2 - 1) ) #=> -3x - 3
ResidueClassRing.create(ring, mod)
クラス ring で表現されるを環とその環の元 mod から、 その元を法とした剰余環を表現するクラスを返します。
この戻り値は ResidueClassRing クラスのサブクラスです。
このサブクラスにはクラスメソッドとして ground と
modulus と [x]
が定義され、それぞれ、基礎環 ring、
法 mod を返します。x を代表元とする剰余類を表します。
例: 多項式環を法 x**2 + x + 1
で割る。
require "rational" require "polynomial" require "residue-class-ring" Px = Polynomial(Rational, "x") x = Px.var F = ResidueClassRing(Px, x**2 + x + 1) p F[x + 1]**100 #=> -x - 1
ring が Integer である場合に限り、全ての逆数を予め計算して
保管します。また 0, 1, ... , mod-1
に対応する剰余類の配列を
to_ary で得ることができます。
例: modulo 7 の素体
require "residue-class-ring" F7 = 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]
ResidueClassRing.[x]
x で代表される剰余類を返します。
ResidueClassRing.zero
零元を返します。
ResidueClassRing.unity
単位元を返します。
lift
剰余類の代表元を返します。
zero?
零元であるとき真を返します。
zero
零元を返します。
unity
単位元を返します。
==(other)
等しいとき真を返します。
+(other)
和を計算します。
-(other)
差を計算します。
*(other)
積を計算します。
**(n)
n 乗を計算します。
/(other)
inverse を利用して商を計算します。
inverse
基礎環がユークリッド環であることを仮定して、逆数を返します。 逆数が存在しない場合の値は nil です。