def __init__(self, poly, ambient=None): """ Return the affine hypersurface in the space ambient defined by the polynomial poly. If ambient is not given, it will be constructed based on poly. EXAMPLES:: sage: A.<x, y, z> = AffineSpace(ZZ, 3) sage: AffineHypersurface(x*y-z^3, A) Affine hypersurface defined by -z^3 + x*y in Affine Space of dimension 3 over Integer Ring :: sage: A.<x, y, z> = QQ[] sage: AffineHypersurface(x*y-z^3) Affine hypersurface defined by -z^3 + x*y in Affine Space of dimension 3 over Rational Field TESTS:: sage: H = AffineHypersurface(x*y-z^3) sage: H == loads(dumps(H)) True """ if not is_MPolynomial(poly): raise TypeError, "Defining polynomial (= %s) must be a multivariate polynomial"%poly if ambient == None: R = poly.parent() from sage.schemes.affine.affine_space import AffineSpace ambient = AffineSpace(R.base_ring(), R.ngens()) ambient._coordinate_ring = R AlgebraicScheme_subscheme_affine.__init__(self, ambient, [poly])
def __init__(self, poly, ambient=None): """ Return the affine hypersurface in the space ambient defined by the polynomial poly. If ambient is not given, it will be constructed based on poly. EXAMPLES:: sage: A.<x, y, z> = AffineSpace(ZZ, 3) sage: AffineHypersurface(x*y-z^3, A) Affine hypersurface defined by -z^3 + x*y in Affine Space of dimension 3 over Integer Ring :: sage: A.<x, y, z> = QQ[] sage: AffineHypersurface(x*y-z^3) Affine hypersurface defined by -z^3 + x*y in Affine Space of dimension 3 over Rational Field TESTS:: sage: H = AffineHypersurface(x*y-z^3) sage: H == loads(dumps(H)) True """ if not is_MPolynomial(poly): raise TypeError, "Defining polynomial (= %s) must be a multivariate polynomial" % poly if ambient == None: R = poly.parent() from sage.schemes.affine.affine_space import AffineSpace ambient = AffineSpace(R.base_ring(), R.ngens()) ambient._coordinate_ring = R AlgebraicScheme_subscheme_affine.__init__(self, ambient, [poly])