def affine_patch(self, I, return_embedding=False): r""" Return the `I^{th}` affine patch of this projective space product where ``I`` is a multi-index. INPUT: - ``I`` -- a list or tuple of positive integers. - ``return_embedding`` -- Boolean, if true the projective embedding is also returned. OUTPUT: - An affine space. - An embedding into a product of projective spaces (optional). EXAMPLES:: sage: PP = ProductProjectiveSpaces([2, 2, 2], ZZ, 'x') sage: phi = PP.affine_patch([0, 1, 2], True) sage: phi.domain() Affine Space of dimension 6 over Integer Ring sage: phi Scheme morphism: From: Affine Space of dimension 6 over Integer Ring To: Product of projective spaces P^2 x P^2 x P^2 over Integer Ring Defn: Defined on coordinates by sending (x0, x1, x2, x3, x4, x5) to (1 : x0 : x1 , x2 : 1 : x3 , x4 : x5 : 1) """ if not isinstance(I, (list, tuple)): raise TypeError( 'the argument I=%s must be a list or tuple of positive integers' % I) PP = self.ambient_space() N = PP._dims if len(I) != len(N): raise ValueError('the argument I=%s must have %s entries' % (I, len(N))) I = tuple([int(i) for i in I]) # implicit type checking for i in range(len(I)): if I[i] < 0 or I[i] > N[i]: raise ValueError( "argument i (= %s) must be between 0 and %s." % (I[i], N[i])) try: if return_embedding: return self.__affine_patches[I][1] else: return self.__affine_patches[I][0] except AttributeError: self.__affine_patches = {} except KeyError: pass from sage.schemes.affine.affine_space import AffineSpace AA = AffineSpace(PP.base_ring(), sum(N), 'x') v = list(AA.gens()) index = 0 for i in range(len(I)): v.insert(index + I[i], 1) index += N[i] + 1 phi = AA.hom(v, self) self.__affine_patches.update({I: (AA, phi)}) if return_embedding: return phi else: return AA
def affine_patch(self, I, return_embedding=False): r""" Return the `I^{th}` affine patch of this projective scheme where 'I' is a multi-index. INPUT: - ``I`` -- a list or tuple of positive integers - ``return_embedding`` -- Boolean, if true the projective embedding is also returned OUTPUT: - An affine algebraic scheme - An embedding into a product of projective space (optional) EXAMPLES:: sage: PP.<x,y,z,w,u,v> = ProductProjectiveSpaces([3,1],QQ) sage: W = PP.subscheme([y^2*z-x^3,z^2-w^2,u^3-v^3]) sage: W.affine_patch([0,1],True) (Closed subscheme of Affine Space of dimension 4 over Rational Field defined by: x0^2*x1 - 1, x1^2 - x2^2, x3^3 - 1, Scheme morphism: From: Closed subscheme of Affine Space of dimension 4 over Rational Field defined by: x0^2*x1 - 1, x1^2 - x2^2, x3^3 - 1 To: Closed subscheme of Product of projective spaces P^3 x P^1 over Rational Field defined by: -x^3 + y^2*z, z^2 - w^2, u^3 - v^3 Defn: Defined on coordinates by sending (x0, x1, x2, x3) to (1 : x0 : x1 : x2 , x3 : 1)) """ if not isinstance(I, (list, tuple)): raise TypeError( 'The argument I=%s must be a list or tuple of positive integers' % I) PP = self.ambient_space() N = PP.dimension_relative_components() if len(I) != len(N): raise ValueError('The argument I=%s must have %s entries' % (I, len(N))) I = tuple([int(i) for i in I]) # implicit type checking for i in range(len(I)): if I[i] < 0 or I[i] > N[i]: raise ValueError( "Argument i (= %s) must be between 0 and %s." % (I[i], N[i])) #see if we've already created this affine patch try: if return_embedding: return self.__affine_patches[I] else: return self.__affine_patches[I][0] except AttributeError: self.__affine_patches = {} except KeyError: pass AA = AffineSpace(PP.base_ring(), sum(N), 'x') v = list(AA.gens()) # create the projective embedding index = 0 for i in range(len(I)): v.insert(index + I[i], 1) index += N[i] + 1 phi = AA.hom(v, self) #find the image of the subscheme polys = self.defining_polynomials() xi = phi.defining_polynomials() U = AA.subscheme([f(xi) for f in polys]) phi = U.hom(v, self) self.__affine_patches.update({I: (U, phi)}) if return_embedding: return U, phi else: return U
def affine_patch(self, I, return_embedding = False): r""" Return the `I^{th}` affine patch of this projective space product where ``I`` is a multi-index. INPUT: - ``I`` -- a list or tuple of positive integers - ``return_embedding`` -- Boolean, if true the projective embedding is also returned OUTPUT: - An affine space - An embedding into a product of projective spaces (optional) EXAMPLES:: sage: PP = ProductProjectiveSpaces([2,2,2], ZZ, 'x') sage: phi = PP.affine_patch([0,1,2], True) sage: phi.domain() Affine Space of dimension 6 over Integer Ring sage: phi Scheme morphism: From: Affine Space of dimension 6 over Integer Ring To: Product of projective spaces P^2 x P^2 x P^2 over Integer Ring Defn: Defined on coordinates by sending (x0, x1, x2, x3, x4, x5) to (1 : x0 : x1 , x2 : 1 : x3 , x4 : x5 : 1) """ if not isinstance(I, (list, tuple)): raise TypeError('The argument I=%s must be a list or tuple of positive integers'%I) PP = self.ambient_space() N = PP._dims if len(I) != len(N): raise ValueError('The argument I=%s must have %s entries'%(I,len(N))) I = tuple([int(i) for i in I]) # implicit type checking for i in range(len(I)): if I[i] < 0 or I[i] > N[i]: raise ValueError("Argument i (= %s) must be between 0 and %s."%(I[i], N[i])) try: if return_embedding: return self.__affine_patches[I][1] else: return self.__affine_patches[I][0] except AttributeError: self.__affine_patches = {} except KeyError: pass from sage.schemes.affine.affine_space import AffineSpace AA = AffineSpace(PP.base_ring(),sum(N),'x') v = list(AA.gens()) index = 0 for i in range(len(I)): v.insert(index+I[i],1) index += N[i]+1 phi = AA.hom(v,self) self.__affine_patches.update({I:(AA,phi)}) if return_embedding: return phi else: return AA