Exemplo n.º 1
0
 def __init__(self, A, X):
     if not is_ProjectiveSpace(A):
         raise TypeError, "A (=%s) must be a projective space"%A
     Curve_generic_projective.__init__(self, A, X)
     d = self.dimension()
     if d != 1:
         raise ValueError, "defining equations (=%s) define a scheme of dimension %s != 1"%(X,d)
Exemplo n.º 2
0
 def __init__(self, A, X):
     if not is_ProjectiveSpace(A):
         raise TypeError, "A (=%s) must be a projective space" % A
     Curve_generic_projective.__init__(self, A, X)
     d = self.dimension()
     if d != 1:
         raise ValueError, "defining equations (=%s) define a scheme of dimension %s != 1" % (
             X, d)
Exemplo n.º 3
0
    def __init__(self, parent, polys, check=True):
        """
        The Python constructor.

        See :class:`SchemeMorphism_polynomial` for details.

        EXAMPLES::

            sage: A2.<x,y> = AffineSpace(QQ,2)
            sage: H = A2.Hom(A2)
            sage: H([x-y, x*y])
            Scheme endomorphism of Affine Space of dimension 2 over Rational Field
              Defn: Defined on coordinates by sending (x, y) to
                    (x - y, x*y)
        """
        if check:
            if not isinstance(polys, (list, tuple)):
                raise TypeError, "polys (=%s) must be a list or tuple" % polys
            source_ring = parent.domain().coordinate_ring()
            target = parent.codomain().ambient_space()
            if len(polys) != target.ngens():
                raise ValueError, "there must be %s polynomials" % target.ngens(
                )
            try:
                polys = [source_ring(poly) for poly in polys]
            except TypeError:
                raise TypeError, "polys (=%s) must be elements of %s" % (
                    polys, source_ring)
            from sage.rings.quotient_ring import QuotientRing_generic
            if isinstance(source_ring, QuotientRing_generic):
                lift_polys = [f.lift() for f in polys]
            else:
                lift_polys = polys
            from sage.schemes.generic.projective_space import is_ProjectiveSpace
            if is_ProjectiveSpace(target):
                # if the codomain is a subscheme of projective space,
                # then we need to make sure that polys have no common
                # zeros
                if isinstance(source_ring, QuotientRing_generic):
                    # if the coordinate ring of the domain is a
                    # quotient by an ideal, we need to check that the
                    # gcd of polys and the generators of the ideal is 1
                    gcd_polys = lift_polys + list(
                        source_ring.defining_ideal().gens())
                else:
                    # if the domain is affine space, we just need to
                    # check the gcd of polys
                    gcd_polys = polys
                from sage.rings.arith import gcd
                if gcd(gcd_polys) != 1:
                    raise ValueError, "polys (=%s) must not have common factors" % polys
            polys = Sequence(lift_polys)
            polys.set_immutable()
            # Todo: check that map is well defined (how?)
        self.__polys = polys
        SchemeMorphism.__init__(self, parent)
Exemplo n.º 4
0
    def __init__(self, parent, polys, check=True):
        """
        The Python constructor.

        See :class:`SchemeMorphism_polynomial` for details.

        EXAMPLES::

            sage: A2.<x,y> = AffineSpace(QQ,2)
            sage: H = A2.Hom(A2)
            sage: H([x-y, x*y])
            Scheme endomorphism of Affine Space of dimension 2 over Rational Field
              Defn: Defined on coordinates by sending (x, y) to
                    (x - y, x*y)
        """
        if check:
            if not isinstance(polys, (list, tuple)):
                raise TypeError, "polys (=%s) must be a list or tuple"%polys
            source_ring = parent.domain().coordinate_ring()
            target = parent.codomain().ambient_space()
            if len(polys) != target.ngens():
                raise ValueError, "there must be %s polynomials"%target.ngens()
            try:
                polys = [source_ring(poly) for poly in polys]
            except TypeError:
                raise TypeError, "polys (=%s) must be elements of %s"%(polys,source_ring)
            from sage.rings.quotient_ring import QuotientRing_generic
            if isinstance(source_ring, QuotientRing_generic):
                lift_polys = [f.lift() for f in polys]
            else:
                lift_polys = polys
            from sage.schemes.generic.projective_space import is_ProjectiveSpace
            if is_ProjectiveSpace(target):
                # if the codomain is a subscheme of projective space,
                # then we need to make sure that polys have no common
                # zeros 
                if isinstance(source_ring, QuotientRing_generic):
                    # if the coordinate ring of the domain is a
                    # quotient by an ideal, we need to check that the
                    # gcd of polys and the generators of the ideal is 1
                    gcd_polys = lift_polys + list(source_ring.defining_ideal().gens())
                else:
                    # if the domain is affine space, we just need to
                    # check the gcd of polys
                    gcd_polys = polys
                from sage.rings.arith import gcd
                if gcd(gcd_polys) != 1:
                    raise ValueError, "polys (=%s) must not have common factors"%polys
            polys = Sequence(lift_polys)
            polys.set_immutable()
            # Todo: check that map is well defined (how?)
        self.__polys = polys
        SchemeMorphism.__init__(self, parent)
Exemplo n.º 5
0
 def __init__(self, parent, polys, check=True):
     if check:
         if not isinstance(polys, (list, tuple)):
             raise TypeError, "polys (=%s) must be a list or tuple"%polys
         source_ring = parent.domain().coordinate_ring()
         target = parent.codomain().ambient_space()
         if len(polys) != target.ngens():
             raise ValueError, "there must be %s polynomials"%target.ngens()
         try:
             polys = [source_ring(poly) for poly in polys]
         except TypeError:
             raise TypeError, "polys (=%s) must be elements of %s"%(polys,source_ring)
         from sage.rings.quotient_ring import QuotientRing_generic
         if isinstance(source_ring, QuotientRing_generic):
             lift_polys = [f.lift() for f in polys]
         else:
             lift_polys = polys
         from sage.schemes.generic.projective_space import is_ProjectiveSpace
         if is_ProjectiveSpace(target):
             # if the codomain is a subscheme of projective space,
             # then we need to make sure that polys have no common
             # zeros 
             if isinstance(source_ring, QuotientRing_generic):
                 # if the coordinate ring of the domain is a
                 # quotient by an ideal, we need to check that the
                 # gcd of polys and the generators of the ideal is 1
                 gcd_polys = lift_polys + list(source_ring.defining_ideal().gens())
             else:
                 # if the domain is affine space, we just need to
                 # check the gcd of polys
                 gcd_polys = polys
             from sage.rings.arith import gcd
             if gcd(gcd_polys) != 1:
                 raise ValueError, "polys (=%s) must not have common factors"%polys
         polys = Sequence(lift_polys)
         polys.set_immutable()
         # Todo: check that map is well defined (how?)
     self.__polys = polys
     SchemeMorphism.__init__(self, parent)
Exemplo n.º 6
0
 def __init__(self, A, f):
     if not (is_ProjectiveSpace(A) and A.dimension != 2):
         raise TypeError, "Argument A (= %s) must be a projective plane."%A
     Curve_generic_projective.__init__(self, A, [f])
Exemplo n.º 7
0
 def __init__(self, A, f):
     if not (is_ProjectiveSpace(A) and A.dimension != 2):
         raise TypeError, "Argument A (= %s) must be a projective plane." % A
     Curve_generic_projective.__init__(self, A, [f])