Esempio n. 1
0
    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 = PolynomialRing(ZZ, 'x').objgen()
            sage: I = R.ideal([4 + 3*x + x^2, 1 + x^2])
            sage: I
            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_element(), )
        self.__gens = gens
        MonoidElement.__init__(self, ring.ideal_monoid())
Esempio n. 2
0
File: ideal.py Progetto: CETHop/sage
    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 = PolynomialRing(ZZ, 'x').objgen()
            sage: I = R.ideal([4 + 3*x + x^2, 1 + x^2])
            sage: I
            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_element(),)
        self.__gens = gens
        MonoidElement.__init__(self, ring.ideal_monoid())
Esempio n. 3
0
File: ideal.py Progetto: dagss/sage
 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())