def __init__(self, ring, gens, coerce=True): """ Initialize this ideal. INPUT: - ``ring`` -- A ring - ``gens`` -- The generators for this ideal - ``coerce`` -- (default: ``True``) If ``gens`` needs to be coerced into ``ring``. EXAMPLES:: sage: R.<x> = ZZ[] sage: R.ideal([4 + 3*x + x^2, 1 + x^2]) Ideal (x^2 + 3*x + 4, x^2 + 1) of Univariate Polynomial Ring in x over Integer Ring """ self.__ring = ring if not isinstance(gens, (list, tuple)): gens = [gens] if coerce: gens = [ring(x) for x in gens] gens = tuple(gens) if len(gens)==0: gens=(ring.zero(),) self.__gens = gens MonoidElement.__init__(self, ring.ideal_monoid())
def __init__(self, ring, gens, coerce=True): """ Initialize this ideal. INPUT: - ``ring`` -- A ring - ``gens`` -- The generators for this ideal - ``coerce`` -- (default: ``True``) If ``gens`` needs to be coerced into ``ring``. EXAMPLES:: sage: R.<x> = ZZ[] sage: R.ideal([4 + 3*x + x^2, 1 + x^2]) Ideal (x^2 + 3*x + 4, x^2 + 1) of Univariate Polynomial Ring in x over Integer Ring """ self.__ring = ring if not isinstance(gens, (list, tuple)): gens = [gens] if coerce: gens = [ring(x) for x in gens] gens = tuple(gens) if len(gens) == 0: gens = (ring.zero(), ) self.__gens = gens MonoidElement.__init__(self, ring.ideal_monoid())
def __init__(self, ring, gens, coerce=True): self.__ring = ring if not isinstance(gens, (list, tuple)): gens = [gens] if coerce: gens = [ring(x) for x in gens] gens = tuple(gens) if len(gens)==0: gens=(ring.zero_element(),) self.__gens = gens MonoidElement.__init__(self, ring.ideal_monoid())