module Algebra::MPolynomial::Monomial

Attributes

coeff[R]
ind[R]

Public Class Methods

extend_object(obj) click to toggle source
Calls superclass method
# File lib/algebra/m-polynomial.rb, line 724
    def self.extend_object(obj)
#      p [obj, obj.class, obj.monomial?, obj == 0]
#      exit unless obj.monomial?
      raise "'#{obj}' must be monomial" unless obj.monomial?
      super
      obj.ind
      obj.coeff
      self
    end

Public Instance Methods

/(other) click to toggle source
Calls superclass method
# File lib/algebra/m-polynomial.rb, line 805
def /(other)
  case other
  when self.class
    self.class[(ind - other.ind), coeff / other.coeff]
  else
    super
  end
end
<=>(other) click to toggle source
# File lib/algebra/m-polynomial.rb, line 768
    def <=>(other)
      #@ind <=> other.ind
#      self.class.order.cmp(@ind, other.ind) #o
      @ind <=> other.ind #n
    end
divide?(other) click to toggle source
# File lib/algebra/m-polynomial.rb, line 774
def divide?(other)
  return true if other.zero?
  case other
  when Monomial
    ind.devide?(other.ind) && (ground.field? ||
                                              ground.euclidian? &&
                                              coeff.devide?(other.coeff))
  else
    raise "unkown self.class #{other}(#{other.class})"
  end
end
divide_or?(other0, other1) click to toggle source
# File lib/algebra/m-polynomial.rb, line 786
def divide_or?(other0, other1)
  return true if other0.zero? && other1.zero?
  if other0.is_a? Monomial and other1.is_a? Monomial
    ind.devide_or?(other0.ind, other1.ind)
  else
    raise "unkown self.class #{other0.class}, #{other1.class}"
  end
end
lcm(other) click to toggle source
# File lib/algebra/m-polynomial.rb, line 814
def lcm(other)
  monomial(ind.lcm(other.ind)).extend(Monomial)
end
prime_to?(other) click to toggle source
# File lib/algebra/m-polynomial.rb, line 795
def prime_to?(other)
  return false if other.zero?
  case other
  when Monomial
    ind.prime_to?(other.ind)
  else
    raise "unkown self.class #{other}(#{other.class})"
  end
end