本文整理匯總了Python中sage.schemes.projective.projective_space.ProjectiveSpace.affine_patch方法的典型用法代碼示例。如果您正苦於以下問題:Python ProjectiveSpace.affine_patch方法的具體用法?Python ProjectiveSpace.affine_patch怎麽用?Python ProjectiveSpace.affine_patch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sage.schemes.projective.projective_space.ProjectiveSpace
的用法示例。
在下文中一共展示了ProjectiveSpace.affine_patch方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: projective_embedding
# 需要導入模塊: from sage.schemes.projective.projective_space import ProjectiveSpace [as 別名]
# 或者: from sage.schemes.projective.projective_space.ProjectiveSpace import affine_patch [as 別名]
def projective_embedding(self, i=None, PP=None):
"""
Returns a morphism from this space into an ambient projective space
of the same dimension.
INPUT:
- ``i`` -- integer (default: dimension of self = last
coordinate) determines which projective embedding to compute. The
embedding is that which has a 1 in the i-th coordinate, numbered
from 0.
- ``PP`` -- (default: None) ambient projective space, i.e.,
codomain of morphism; this is constructed if it is not
given.
EXAMPLES::
sage: AA = AffineSpace(2, QQ, 'x')
sage: pi = AA.projective_embedding(0); pi
Scheme morphism:
From: Affine Space of dimension 2 over Rational Field
To: Projective Space of dimension 2 over Rational Field
Defn: Defined on coordinates by sending (x0, x1) to
(1 : x0 : x1)
sage: z = AA(3, 4)
sage: pi(z)
(1/4 : 3/4 : 1)
sage: pi(AA(0,2))
(1/2 : 0 : 1)
sage: pi = AA.projective_embedding(1); pi
Scheme morphism:
From: Affine Space of dimension 2 over Rational Field
To: Projective Space of dimension 2 over Rational Field
Defn: Defined on coordinates by sending (x0, x1) to
(x0 : 1 : x1)
sage: pi(z)
(3/4 : 1/4 : 1)
sage: pi = AA.projective_embedding(2)
sage: pi(z)
(3 : 4 : 1)
::
sage: A.<x,y> = AffineSpace(ZZ, 2)
sage: A.projective_embedding(2).codomain().affine_patch(2) == A
True
"""
n = self.dimension_relative()
if i is None:
try:
i = self._default_embedding_index
except AttributeError:
i = int(n)
else:
i = int(i)
try:
phi = self.__projective_embedding[i]
#assume that if you've passed in a new codomain you want to override
#the existing embedding
if PP is None or phi.codomain() == PP:
return(phi)
except AttributeError:
self.__projective_embedding = {}
except KeyError:
pass
#if no i-th embedding exists, we may still be here with PP==None
if PP is None:
from sage.schemes.projective.projective_space import ProjectiveSpace
PP = ProjectiveSpace(n, self.base_ring())
elif PP.dimension_relative() != n:
raise ValueError("projective Space must be of dimension %s"%(n))
R = self.coordinate_ring()
v = list(R.gens())
if n < 0 or n >self.dimension_relative():
raise ValueError("argument i (=%s) must be between 0 and %s, inclusive"%(i,n))
v.insert(i, R(1))
phi = self.hom(v, PP)
self.__projective_embedding[i] = phi
#make affine patch and projective embedding match
PP.affine_patch(i,self)
return phi