(Class of Localization of Ring)
This class creates the fraction ring of the given ring. To make a concrete class, use the class method LocalizedRing.create or the function LocalizedRing.
none.
LocalizedRing(ring)
Same as LocalizedRing.create(ring).
RationalFunctionField(ring, obj)
Creates the rational function field over ring with the variable expressed by obj. This class is equipped with the class method var which returns the variable.
Example: the quotient field over the polynomial ring over Integer
require "localized-ring" F = RationalFunctionField(Integer, "x") x = F.var p ( 1 / (x**2 - 1) - 1 / (x**3 - 1) ) #=> (x^3 - x^2)/(x^5 - x^3 - x^2 + 1)
LocalizedRing.create(ring)
Returns the fraction ring of which the numerator and the denominator are the elements of the ring.
This returns the subclass of LocalizedRing. The subclass
has the class method ground and [x]
which
return ring and x/1
respectively.
Example: Yet Another Rational
require "localized-ring" F = LocalizedRing(Integer) p F.new(1, 2) + F.new(2, 3) #=> 7/6
Example: rational function field over Integer
require "polynomial" require "localized-ring" P = Polynomial(Integer, "x") F = LocalizedRing(P) x = F[P.var] p ( 1 / (x**2 - 1) - 1 / (x**3 - 1) ) #=> (x^3 - x^2)/(x^5 - x^3 - x^2 + 1)
LocalizedRing.zero
Returns zero.
LocalizedRing.unity
Returns unity.
zero?
Returns true if self is zero.
zero
Returns zero.
unity
Returns unity.
==(other)
Returns true if self equals other.
+(other)
Returns the sum of self and other.
-(other)
Returns the difference of self from other.
*(other)
Returns the product of self and other.
/(other)
Returns the quotient of self by other using inverse.
**(n)
Returns the n-th power of self.