# HG changeset patch
# User davideklund <daek@kth.se>
# Date 1324125053 3600
# Node ID c369c262e668bea81d320973be8f64340088a0cf
# Parent 2a2abbcad325ccca9399981ceddf5897eb467e64
Trac 11800: Ban defining polynomials of degree 2.
diff r 2a2abbcad325 r c369c262e668 sage/schemes/hyperelliptic_curves/constructor.py
a

b


55  55  sage: k.<a> = GF(9); R.<x> = k[] 
56  56  sage: HyperellipticCurve(x^3 + x  1, x+a, names=['X','Y']) 
57  57  Hyperelliptic Curve over Finite Field in a of size 3^2 defined by Y^2 + (X + a)*Y = X^3 + X + 2 
 58  
 59  Conics are excluded (the issue reported at #11800 has been resolved):: 
 60  
 61  sage: R.<x> = GF(67)[] 
 62  sage: H = HyperellipticCurve(24*x^2 + 33*x + 43) 
 63  Traceback (most recent call last): 
 64  ... 
 65  ValueError: The equation y^2+hy=f is quadratic, and hence does not correspond to a hyperelliptic curve. 
58  66  """ 
59  67  if not is_Polynomial(f): 
60  68  raise TypeError, "Arguments f (=%s) and h (= %s) must be polynomials"%(f,h) 
… 
… 

68  76  raise TypeError, \ 
69  77  "Arguments f (=%s) and h (= %s) must be polynomials in the same ring"%(f,h) 
70  78  df = f.degree() 
71   dh_2 = 2*h.degree() 
 79  dh = h.degree() 
 80  if df <= 2 and dh <= 1: 
 81  raise ValueError("The equation y^2+hy=f is quadratic, and hence " 
 82  "does not correspond to a hyperelliptic curve.") 
 83  dh_2 = 2*dh 
72  84  if dh_2 < df: 
73  85  g = (df1)//2 
74  86  elif df < dh_2: 
… 
… 

76  88  else: 
77  89  a0 = f.leading_coefficient() 
78  90  b0 = h.leading_coefficient() 
79   A0 = 4*a0 + b0^2 
 91  A0 = 4*a0 + b0**2 
80  92  if A0 != 0: 
81  93  g = (df1)//2 
82  94  else: 
83  95  if P(2) == 0: 
84  96  raise TypeError, "Arguments define a curve with finite singularity." 
85   f0 = 4*f + h^2 
 97  f0 = 4*f + h**2 
86  98  d0 = f0.degree() 
87  99  g = (d01)//2 
88  100  R = P.base_ring() 