Ticket #11800: 11800.patch

File 11800.patch, 1.6 KB (added by mstreng, 8 years ago)

rebase to apply after #11930

  • sage/schemes/hyperelliptic_curves/constructor.py

    # HG changeset patch
    # User davideklund <daek@kth.se>
    # Date 1324125053 -3600
    # Node ID 6f1b82ae59dfb1f46806f424bf31f110f58acf60
    # Parent  95d49e2ea03b9405b1f2039c8a3277abc325098c
    Trac 11800: Ban defining polynomials of degree 2.
    
    diff --git a/sage/schemes/hyperelliptic_curves/constructor.py b/sage/schemes/hyperelliptic_curves/constructor.py
    a b  
    5555        sage: k.<a> = GF(9); R.<x> = k[]   
    5656        sage: HyperellipticCurve(x^3 + x - 1, x+a, names=['X','Y'])
    5757        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.
    5866    """
    5967    if (not is_Polynomial(f)) or f == 0:
    6068        raise TypeError, "Arguments f (=%s) and h (= %s) must be polynomials and f must be non-zero"%(f,h)
     
    6775        raise TypeError, \
    6876              "Arguments f (=%s) and h (= %s) must be polynomials in the same ring"%(f,h)
    6977    df = f.degree()
    70     dh_2 = 2*h.degree()
     78    dh = h.degree()
     79    if df <= 2 and dh <= 1:
     80        raise ValueError("The equation y^2+hy=f is quadratic, and hence "
     81                         "does not correspond to a hyperelliptic curve.")
     82    dh_2 = 2*dh
    7183    if dh_2 < df:
    7284        g = (df-1)//2
    7385    else: