module Algebra::PolynomialConvertTo

Public Instance Methods

convert_to(other) click to toggle source
# File lib/algebra/polynomial-converter.rb, line 13
def convert_to(other)
  if other <= MPolynomial
    g = self
    vs = []
    while g <= Polynomial
      vs.push g.variable
      #     vs.push g.var
      g = g.ground
    end
    MPolynomial.create(g, *vs)
  else
    raise "unkown self.class (#{other})"
  end
end