def __init__(self, poly, ambient=None): """ Return the projective hypersurface in the space ambient defined by the polynomial poly. If ambient is not given, it will be constructed based on poly. EXAMPLES:: sage: P.<x, y, z> = ProjectiveSpace(ZZ, 2) sage: ProjectiveHypersurface(x-y, P) Projective hypersurface defined by x - y in Projective Space of dimension 2 over Integer Ring :: sage: R.<x, y, z> = QQ[] sage: ProjectiveHypersurface(x-y) Projective hypersurface defined by x - y in Projective Space of dimension 2 over Rational Field TESTS:: sage: H = ProjectiveHypersurface(x-y) sage: H == loads(dumps(H)) True """ if not is_MPolynomial(poly): raise TypeError( "Defining polynomial (=%s) must be a multivariate polynomial." % poly) if not poly.is_homogeneous(): raise TypeError("Defining polynomial (=%s) must be homogeneous." % poly) if ambient is None: R = poly.parent() from sage.schemes.projective.projective_space import ProjectiveSpace ambient = ProjectiveSpace(R.base_ring(), R.ngens() - 1) ambient._coordinate_ring = R AlgebraicScheme_subscheme_projective.__init__(self, ambient, [poly])
def __init__(self, poly, ambient=None): """ Return the projective hypersurface in the space ambient defined by the polynomial poly. If ambient is not given, it will be constructed based on poly. EXAMPLES:: sage: P.<x, y, z> = ProjectiveSpace(ZZ, 2) sage: ProjectiveHypersurface(x-y, P) Projective hypersurface defined by x - y in Projective Space of dimension 2 over Integer Ring :: sage: R.<x, y, z> = QQ[] sage: ProjectiveHypersurface(x-y) Projective hypersurface defined by x - y in Projective Space of dimension 2 over Rational Field TESTS:: sage: H = ProjectiveHypersurface(x-y) sage: H == loads(dumps(H)) True """ if not is_MPolynomial(poly): raise TypeError, \ "Defining polynomial (=%s) must be a multivariate polynomial."%poly if not poly.is_homogeneous(): raise TypeError, "Defining polynomial (=%s) must be homogeneous."%poly if ambient == None: R = poly.parent() from sage.schemes.projective.projective_space import ProjectiveSpace ambient = ProjectiveSpace(R.base_ring(), R.ngens()-1) ambient._coordinate_ring = R AlgebraicScheme_subscheme_projective.__init__(self, ambient, [poly])