Ticket #14472: trac_14472-elliptic_curves_jd.patch

File trac_14472-elliptic_curves_jd.patch, 5.2 KB (added by Jeroen Demeyer, 10 years ago)
  • sage/libs/pari/gen.pyx

    # HG changeset patch
    # User John Cremona <john.cremona@gmail.com>
    # Date 1366625903 -3600
    # Node ID 196d20a9b1232d82c584a4adcc64a58f65520fbb
    # Parent  83d1a1c77aa5aa4bba541c43c9860cd6ffb7f148
    trac #14472: elliptic curves over relative number fields
    
    diff --git a/sage/libs/pari/gen.pyx b/sage/libs/pari/gen.pyx
    a b  
    73587358        sig_on()
    73597359        return self.new_gen(nfdisc0(self.g, flag, g))
    73607360
     7361    def nfeltdiveuc(self, x, y):
     7362        """
     7363        Given `x` and `y` in the number field ``self``, return `q` such
     7364        that `x - q y` is "small".
     7365       
     7366        EXAMPLES::
     7367
     7368            sage: k.<a> = NumberField(x^2 + 5)
     7369            sage: x = 10
     7370            sage: y = a + 1
     7371            sage: pari(k).nfeltdiveuc(pari(x), pari(y))
     7372            [2, -2]~
     7373        """
     7374        t0GEN(x); t1GEN(y)
     7375        sig_on()
     7376        return self.new_gen(nfdiveuc(self.g, t0, t1))
     7377
    73617378    def nfeltreduce(self, x, I):
    73627379        """
    73637380        Given an ideal I in Hermite normal form and an element x of the pari
     
    98009817        try:
    98019818            return self(x)
    98029819        except (TypeError, AttributeError):
    9803             raise TypeError, "no canonical coercion of %s into PARI"%x
    9804         if isinstance(x, gen):
    9805             return x
    9806         raise TypeError, "x must be a PARI object"
     9820            raise TypeError("no canonical coercion of %s into PARI"%x)
    98079821
    98089822    cdef _an_element_c_impl(self):  # override this in Cython
    98099823        return self.PARI_ZERO
  • sage/schemes/elliptic_curves/ell_number_field.py

    diff --git a/sage/schemes/elliptic_curves/ell_number_field.py b/sage/schemes/elliptic_curves/ell_number_field.py
    a b  
    641641            (1, 1, 0, -2509254, 1528863051)
    642642            sage: EllipticCurve([-101,-202,-303,-404,-505])._reduce_model().ainvs()
    643643            (1, -1, 0, -1823195, 947995262)
     644
     645            sage: E = EllipticCurve([a/4, 1])
     646            sage: E._reduce_model()
     647            Traceback (most recent call last):
     648            ...
     649            TypeError: _reduce_model() requires an integral model.
    644650        """
    645         ZK = self.base_ring().maximal_order()
     651        K = self.base_ring()
     652        ZK = K.maximal_order()
    646653        try:
    647654            (a1, a2, a3, a4, a6) = [ZK(a) for a in self.a_invariants()]
    648655        except TypeError:
    649             raise TypeError, "_reduce_model() requires an integral model."
     656            import sys
     657            raise TypeError, "_reduce_model() requires an integral model.", sys.exc_info()[2]
     658
    650659        # N.B. Must define s, r, t in the right order.
    651         if ZK.degree() == 1:
     660        if ZK.absolute_degree() == 1:
    652661            s = ((-a1)/2).round('up')
    653662            r = ((-a2 + s*a1 +s*s)/3).round()
    654663            t = ((-a3 - r*a1)/2).round('up')
    655664        else:
    656             s = ZK([(a/2).round('up') for a in (-a1).list()])
    657             r = ZK([(a/3).round() for a in (-a2 + s*a1 +s*s).list()])
    658             t = ZK([(a/2).round('up') for a in (-a3 - r*a1).list()])
     665            pariK = K._pari_()
     666            s = K(pariK.nfeltdiveuc(-a1, 2))
     667            r = K(pariK.nfeltdiveuc(-a2 + s*a1 + s*s, 3))
     668            t = K(pariK.nfeltdiveuc(-a3 - r*a1, 2))
    659669
    660670        return self.rst_transform(r, s, t)
    661671
     
    848858        EXAMPLES::
    849859
    850860            sage: K.<a>=NumberField(x^2-5)
    851             sage: E=EllipticCurve([20, 225, 750, 625*a + 6875, 31250*a + 46875])
     861            sage: E=EllipticCurve([20, 225, 750, 1250*a + 6250, 62500*a + 15625])
    852862            sage: P=K.ideal(a)
    853863            sage: E.local_minimal_model(P).ainvs()
    854             (0, 1, 0, a - 33, -2*a + 64)
     864            (0, 1, 0, 2*a - 34, -4*a + 66)
    855865        """
    856866        if proof is None:
    857867            import sage.structure.proof.proof
     
    11951205            # uu is the quotient of the Neron differential at pp divided by
    11961206            # the differential associated to this particular equation E
    11971207            uu = self.isomorphism_to(dav.minimal_model()).u
    1198             if self.base_field().degree() == 1:
     1208            if self.base_field().absolute_degree() == 1:
    11991209                p = pp.gens_reduced()[0]
    12001210                f = 1
    12011211                v = valuation(ZZ(uu),p)
     
    13301340            sage: E2.local_data()
    13311341            []
    13321342
    1333         See trac \#11347::
     1343        See :trac:`11347`::
    13341344
    13351345            sage: K.<g> = NumberField(x^2 - x - 1)
    13361346            sage: E = EllipticCurve(K,[0,0,0,-1/48,161/864]).integral_model().global_minimal_model(); E
     
    13391349            [(9, 1), (5, 1)]
    13401350            sage: [(p.norm(), e) for p, e in E.discriminant().factor()]
    13411351            [(9, 1), (-5, 2)]
     1352
     1353        See :trac:`14472`, this used not to work over a relative extension::
     1354
     1355            sage: K1.<w> = NumberField(x^2+x+1)
     1356            sage: m = polygen(K1)
     1357            sage: K2.<v> = K1.extension(m^2-w+1)
     1358            sage: E = EllipticCurve([0*v,-432])
     1359            sage: E.global_minimal_model()
     1360            Elliptic Curve defined by y^2 + (v+w+1)*y = x^3 + ((6*w-10)*v+16*w+20) over Number Field in v with defining polynomial x^2 - w + 1 over its base field
    13421361        """
    13431362        if proof is None:
    13441363            import sage.structure.proof.proof