Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

r""" 

Hypersurfaces in affine and projective space 

 

AUTHORS: 

 

- William Stein <wstein@gmail.com> (2005-12-08) 

- David Kohel <kohel@maths.usyd.edu.au> (2005-12-08) 

- Alex Ghitza <aghitza@alum.mit.edu> (2009-04-17) 

""" 

from __future__ import absolute_import 

 

#***************************************************************************** 

# Copyright (C) 2005 William Stein <wstein@gmail.com> 

# 

# Distributed under the terms of the GNU General Public License (GPL) 

# 

# The full text of the GPL is available at: 

# 

# http://www.gnu.org/licenses/ 

#***************************************************************************** 

 

from sage.rings.polynomial.multi_polynomial_element import is_MPolynomial 

from sage.schemes.affine.affine_subscheme import AlgebraicScheme_subscheme_affine 

from sage.schemes.projective.projective_subscheme import AlgebraicScheme_subscheme_projective 

 

def is_Hypersurface(self): 

""" 

Return True if self is a hypersurface, i.e. an object of the type 

ProjectiveHypersurface or AffineHypersurface. 

 

EXAMPLES:: 

 

sage: from sage.schemes.generic.hypersurface import is_Hypersurface 

sage: R.<x, y, z> = ZZ[] 

sage: H = ProjectiveHypersurface(x*z+y^2) 

sage: is_Hypersurface(H) 

True 

 

:: 

 

sage: H = AffineHypersurface(x*z+y^2) 

sage: is_Hypersurface(H) 

True 

 

:: 

 

sage: H = ProjectiveSpace(QQ, 5) 

sage: is_Hypersurface(H) 

False 

""" 

return isinstance(self, (ProjectiveHypersurface, AffineHypersurface)) 

 

class ProjectiveHypersurface(AlgebraicScheme_subscheme_projective): 

""" 

The projective hypersurface defined by the given polynomial. 

 

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 

""" 

 

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 _repr_(self): 

""" 

Return a string representation of this projective 

hypersurface. 

 

EXAMPLES:: 

 

sage: R.<x, y, z> = ZZ[] 

sage: H = ProjectiveHypersurface(x*z+y^2) 

sage: H 

Projective hypersurface defined by y^2 + x*z in Projective Space of dimension 2 over Integer Ring 

sage: H._repr_() 

'Projective hypersurface defined by y^2 + x*z in Projective Space of dimension 2 over Integer Ring' 

""" 

return "Projective hypersurface defined by %s in %s"%( 

self.defining_polynomial(), self.ambient_space()) 

 

def defining_polynomial(self): 

""" 

Return the polynomial equation that cuts out this projective 

hypersurface. 

 

EXAMPLES:: 

 

sage: R.<x, y, z> = ZZ[] 

sage: H = ProjectiveHypersurface(x*z+y^2) 

sage: H.defining_polynomial() 

y^2 + x*z 

""" 

return self.defining_polynomials()[0] 

 

 

class AffineHypersurface(AlgebraicScheme_subscheme_affine): 

""" 

The affine hypersurface defined by the given polynomial. 

 

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 

""" 

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 is 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 _repr_(self): 

""" 

Return a string representation of this affine 

hypersurface. 

 

EXAMPLES:: 

 

sage: R.<x, y, z> = ZZ[] 

sage: H = AffineHypersurface(x*z+y^2) 

sage: H 

Affine hypersurface defined by y^2 + x*z in Affine Space of dimension 3 over Integer Ring 

sage: H._repr_() 

'Affine hypersurface defined by y^2 + x*z in Affine Space of dimension 3 over Integer Ring' 

""" 

return "Affine hypersurface defined by %s in %s"%( 

self.defining_polynomial(), self.ambient_space()) 

 

def defining_polynomial(self): 

""" 

Return the polynomial equation that cuts out this affine 

hypersurface. 

 

EXAMPLES:: 

 

sage: R.<x, y, z> = ZZ[] 

sage: H = AffineHypersurface(x*z+y^2) 

sage: H.defining_polynomial() 

y^2 + x*z 

""" 

return self.defining_polynomials()[0]