Ticket #14472: trac_14472-elliptic_curves.patch

File trac_14472-elliptic_curves.patch, 3.6 KB (added by John Cremona, 10 years ago)

Applies to 5.9.beta5

  • sage/schemes/elliptic_curves/ell_number_field.py

    # HG changeset patch
    # User John Cremona <john.cremona@gmail.com>
    # Date 1366625903 -3600
    # Node ID 76daa4a85cabd91e880f11f8c070a62d4a3bf31a
    # Parent  0ff9ad40fa3cf8039843c54264208b05d6c3b4e5
    trac #14472: elliptic curves over relative number fields
    
    diff --git a/sage/schemes/elliptic_curves/ell_number_field.py b/sage/schemes/elliptic_curves/ell_number_field.py
    a b  
    648648        except TypeError:
    649649            raise TypeError, "_reduce_model() requires an integral model."
    650650        # N.B. Must define s, r, t in the right order.
    651         if ZK.degree() == 1:
     651        if ZK.absolute_degree() == 1:
    652652            s = ((-a1)/2).round('up')
    653653            r = ((-a2 + s*a1 +s*s)/3).round()
    654654            t = ((-a3 - r*a1)/2).round('up')
    655655        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()])
     656            red3Z = lambda x: -1+(x+1)%3
     657            red2Z = lambda x: (x)%2
     658            red2ZK = lambda w: sum([red2Z(ci)*ai for ci,ai in zip(ZK.coordinates(w),ZK.gens())])
     659            red3ZK = lambda w: sum([red3Z(ci)*ai for ci,ai in zip(ZK.coordinates(w),ZK.gens())])
     660            w = a1;                a1red = red2ZK(w);  s = (a1red-w)/2
     661            w = a2 - s*a1 - s**2;  a2red = red3ZK(w);  r = (a2red-w)/3
     662            w = a3 + r*a1;         a3red = red2ZK(w);  t = (a3red-w)/2
    659663
    660664        return self.rst_transform(r, s, t)
    661665
     
    847851
    848852        EXAMPLES::
    849853
    850             sage: K.<a>=NumberField(x^2-5)
    851             sage: E=EllipticCurve([20, 225, 750, 625*a + 6875, 31250*a + 46875])
    852             sage: P=K.ideal(a)
     854            sage: K.<a>=NumberField(x^2-x-1)
     855            sage: E=EllipticCurve([20, 225, 750, 1250*a + 6250, 62500*a + 15625])
     856            sage: P=K.ideal(1-2*a)
    853857            sage: E.local_minimal_model(P).ainvs()
    854             (0, 1, 0, a - 33, -2*a + 64)
     858            (0, 1, 0, 2*a - 34, -4*a + 66)
    855859        """
    856860        if proof is None:
    857861            import sage.structure.proof.proof
     
    11951199            # uu is the quotient of the Neron differential at pp divided by
    11961200            # the differential associated to this particular equation E
    11971201            uu = self.isomorphism_to(dav.minimal_model()).u
    1198             if self.base_field().degree() == 1:
     1202            if self.base_field().absolute_degree() == 1:
    11991203                p = pp.gens_reduced()[0]
    12001204                f = 1
    12011205                v = valuation(ZZ(uu),p)
     
    13301334            sage: E2.local_data()
    13311335            []
    13321336
    1333         See trac \#11347::
     1337        See (:trac:`11347`)::
    13341338
    13351339            sage: K.<g> = NumberField(x^2 - x - 1)
    13361340            sage: E = EllipticCurve(K,[0,0,0,-1/48,161/864]).integral_model().global_minimal_model(); E
     
    13391343            [(9, 1), (5, 1)]
    13401344            sage: [(p.norm(), e) for p, e in E.discriminant().factor()]
    13411345            [(9, 1), (-5, 2)]
     1346
     1347        See (:trac:`14472`): this used not to work over a relative extension::
     1348
     1349            sage: K1.<w>=NumberField(x^2+x+1)
     1350            sage: m=polygen(K1)
     1351            sage: K2.<v>=K1.extension(m^2-w+1)
     1352            sage: E=EllipticCurve([0*v,-432])
     1353            sage: E.global_minimal_model()
     1354            Elliptic Curve defined by y^2 + (v+w-1)*y = x^3 + ((6*w-9)*v+17*w+20) over Number Field in v with defining polynomial x^2 - w + 1 over its base field
     1355
    13421356        """
    13431357        if proof is None:
    13441358            import sage.structure.proof.proof