Ticket #9095: 9095-ec-function-fields.patch

File 9095-ec-function-fields.patch, 5.6 KB (added by robertwb, 12 years ago)

elliptic curve function field class

  • sage/schemes/elliptic_curves/constructor.py

    # HG changeset patch
    # User Robert Bradshaw <robertwb@math.washington.edu>
    # Date 1275214622 25200
    # Node ID 095509ccfbde30e933ea9acafd1920d303f59d9c
    # Parent  1166db8627ff22da9f93c73f08c314b89a4479e2
    #9095 - elliptic curves over function fields
    
    diff -r 1166db8627ff -r 095509ccfbde sage/schemes/elliptic_curves/constructor.py
    a b  
    180180        ValueError: First parameter must be a ring containing 3/5
    181181
    182182    """
    183     import ell_generic, ell_field, ell_finite_field, ell_number_field, ell_rational_field, ell_padic_field  # here to avoid circular includes
     183    import ell_generic, ell_field, ell_finite_field, ell_number_field, ell_function_field, ell_rational_field, ell_padic_field  # here to avoid circular includes
    184184   
    185185    if j is not None:
    186186        if not x is None:
     
    250250            return ell_padic_field.EllipticCurve_padic_field(x, y)
    251251        elif rings.is_NumberField(x):
    252252            return ell_number_field.EllipticCurve_number_field(x, y)
     253        elif rings.is_FunctionField(x):
     254            return ell_function_field.EllipticCurve_function_field(x, y)
    253255        elif rings.is_Field(x):
    254256            return ell_field.EllipticCurve_field(x, y)
    255257        return ell_generic.EllipticCurve_generic(x, y)
  • new file sage/schemes/elliptic_curves/ell_function_field.py

    diff -r 1166db8627ff -r 095509ccfbde sage/schemes/elliptic_curves/ell_function_field.py
    - +  
     1r"""
     2Elliptic curves over function fields.
     3
     4EXAMPLES::
     5
     6The Legendre curve::
     7
     8    sage: K.<t> = FunctionField(GF(5))
     9    sage: E = EllipticCurve(K, [0, t^2+t, 0, t^3, 0]); E
     10    Elliptic Curve defined by y^2 = x^3 + (t^2+t)*x^2 + t^3*x over Rational function field in t over Finite Field of size 5
     11
     12A rank 2 twist::
     13
     14    sage: E = E.quadratic_twist(t+1).short_weierstrass_model()
     15    sage: P = E.lift_x(3*t^3 + t^2 - t)
     16    sage: Q = E.lift_x(3*t^3 + 2*t^2 + 3*t)
     17"""
     18
     19
     20######################################################################
     21#  Copyright (C) 2010 Robert Bradshaw <robertwb@math.washington.edu>
     22#  Copyright (C) 2010 Thomas Occhipinti <tocchi@gmail.com>
     23#
     24#  Distributed under the terms of the GNU General Public License (GPL)
     25#
     26#                  http://www.gnu.org/licenses/
     27######################################################################
     28
     29
     30from ell_field import EllipticCurve_field
     31import ell_point
     32
     33class EllipticCurve_function_field(EllipticCurve_field):
     34   
     35    def __init__(self, K, ainvs):
     36        """
     37        An elliptic curve defined over a function field.
     38       
     39        EXAMPLES::
     40       
     41            sage: K.<t> = FunctionField(GF(5))
     42            sage: E = EllipticCurve(K, [2,t]); E
     43            Elliptic Curve defined by y^2 = x^3 + 2*x + t over Rational function field in t over Finite Field of size 5
     44            sage: type(E)
     45            <class 'sage.schemes.elliptic_curves.ell_function_field.EllipticCurve_function_field'>
     46            sage: type(E(0))
     47            <class 'sage.schemes.elliptic_curves.ell_function_field.EllipticCurvePoint_function_field'>
     48        """
     49        EllipticCurve_field.__init__(self, [K(x) for x in ainvs])
     50        self._point_class = EllipticCurvePoint_function_field
     51
     52
     53class EllipticCurvePoint_function_field(ell_point.EllipticCurvePoint_field):
     54    pass
  • sage/schemes/elliptic_curves/ell_generic.py

    diff -r 1166db8627ff -r 095509ccfbde sage/schemes/elliptic_curves/ell_generic.py
    a b  
    24732473            if complete_cube and b2 != 0:
    24742474                raise ValueError, "short_weierstrass_model(): no short model for %s (characteristic is %s)"%(self,K.characteristic())
    24752475            else:
    2476                 return constructor.EllipticCurve([0,b2,0,8*b4,16*b6])
     2476                return constructor.EllipticCurve(K, [0,b2,0,8*b4,16*b6])
    24772477
    24782478        a1,a2,a3,_,_ = self.a_invariants()
    24792479        if complete_cube:
     
    24822482            else:
    24832483                b2,b4,b6,_ = self.b_invariants()
    24842484                if b2==0:
    2485                     return constructor.EllipticCurve([0,0,0,8*b4,16*b6])
     2485                    return constructor.EllipticCurve(K, [0,0,0,8*b4,16*b6])
    24862486                else:
    24872487                    c4, c6 = self.c_invariants()
    2488                     return constructor.EllipticCurve([0,0,0,-27*c4, -54*c6])
     2488                    return constructor.EllipticCurve(K, [0,0,0,-27*c4, -54*c6])
    24892489        else:
    24902490            if a1==0 and a3==0:
    24912491                return self
    24922492            else:
    24932493                b2,b4,b6,_ = self.b_invariants()
    2494                 return constructor.EllipticCurve([0,b2,0,8*b4,16*b6])
     2494                return constructor.EllipticCurve(K, [0,b2,0,8*b4,16*b6])
    24952495
    24962496
    24972497   
  • sage/schemes/elliptic_curves/weierstrass_morphism.py

    diff -r 1166db8627ff -r 095509ccfbde sage/schemes/elliptic_curves/weierstrass_morphism.py
    a b  
    351351    c4F,c6F = F.c_invariants()
    352352
    353353    if j==0:
    354         m,um = 6,c6E/c6F
     354        ulist=(x**6 - c6E/c6F).roots(multiplicities=False)
    355355    elif j==1728:
    356         m,um=4,c4E/c4F
     356        ulist=(x**4 - c4E/c4F).roots(multiplicities=False)
    357357    else:
    358         m,um=2,(c6E*c4F)/(c6F*c4E)
    359     ulist=(x**m-um).roots(multiplicities=False)
     358        ulist = ((c6E*c4F)/(c6F*c4E)).sqrt(all=True)
    360359    ans=[]
    361360    for u in ulist:
    362361        s = (a1F*u - a1E)/2