Ticket #14476: trac_14476_bugs_in_local_data.patch

File trac_14476_bugs_in_local_data.patch, 5.1 KB (added by wuthrich, 8 years ago)

The attached patch was exported from 5.9 after having applied the patched for #12509 #13953 #11630 in that order. I

  • sage/schemes/elliptic_curves/ell_number_field.py

    # HG changeset patch
    # User Chris Wuthrich <christian.wuthrich@gmail.com>
    # Date 1367783340 -3600
    # Node ID bec090ea3f9ad25e237a4f8824ddf11b642f477d
    # Parent  e39cf9ba9610a7dcfca4d1bd197b3cddf269e06a
    trac 14476 : bug in global_integral_model
    
    diff --git a/sage/schemes/elliptic_curves/ell_number_field.py b/sage/schemes/elliptic_curves/ell_number_field.py
    a b  
    594594            sage: E = EllipticCurve([25105/216*v - 3839/36, 634768555/7776*v - 98002625/1296, 634768555/7776*v - 98002625/1296, 0, 0])
    595595            sage: E.global_integral_model()
    596596            Elliptic Curve defined by y^2 + (33872485050625*v-31078224284250)*x*y + (2020602604156076340058146664245468750000*v-1871778534673615560803175189398437500000)*y = x^3 + (6933305282258321342920781250*v-6422644400723486559914062500)*x^2 over Number Field in v with defining polynomial x^2 + 161*x - 150
     597
     598        trac #14476::
     599
     600            sage: R.<t> = QQ[]
     601            sage: K.<g> = NumberField(t^4 - t^3 - 3*t^2 - t + 1)
     602            sage: E = EllipticCurve([ -43/625*g^3 + 14/625*g^2 - 4/625*g + 706/625, -4862/78125*g^3 - 4074/78125*g^2 - 711/78125*g + 10304/78125,  -4862/78125*g^3 - 4074/78125*g^2 - 711/78125*g + 10304/78125, 0,0])
     603            sage: E.global_integral_model()
     604            Elliptic Curve defined by y^2 + (-18*g^3+29*g^2+63*g+7)*x*y + (-704472*g^3-958584*g^2-166242*g+298101)*y = x^3 + (-2859*g^3-3978*g^2-669*g+1332)*x^2 over Number Field in g with defining polynomial t^4 - t^3 - 3*t^2 - t + 1
     605
    597606        """
    598607        K = self.base_field()
    599608        ai = self.a_invariants()
    600         for a in ai:
    601             if not a.is_integral():
    602                for P, _ in a.denominator_ideal().factor():
    603                    pi = K.uniformizer(P,'positive')
    604                    e  = min([(ai[i].valuation(P)/[1,2,3,4,6][i]) for i in range(5)]).floor()
    605                    ai = [ai[i]/pi**(e*[1,2,3,4,6][i]) for i in range(5)]
     609        Ps = [[ ff[0] for ff in a.denominator_ideal().factor() ] for a in ai if not a.is_integral() ]
     610        Ps = sage.misc.misc.union(sage.misc.flatten.flatten(Ps))
     611        for P in Ps:
     612            pi = K.uniformizer(P,'positive')
     613            e  = min([(ai[i].valuation(P)/[1,2,3,4,6][i]) for i in range(5)]).floor()
     614            if e < 0 :
     615                ai = [ai[i]/pi**(e*[1,2,3,4,6][i]) for i in range(5)]
     616            if all(a.is_integral() for a in ai):
     617                break
    606618        for z in ai:
    607619            assert z.is_integral(), "bug in global_integral_model: %s" % list(ai)
    608620        return EllipticCurve(list(ai))
  • sage/schemes/elliptic_curves/ell_local_data.py

    # HG changeset patch
    # User Chris Wuthrich <christian.wuthrich@gmail.com>
    # Date 1367786723 -3600
    # Node ID 925e64fcc46122eed5b1a4cf59d89ca1484206f8
    # Parent  bec090ea3f9ad25e237a4f8824ddf11b642f477d
    trac 14476: local minimum model is only reduced when it comes from a global integral model
    
    diff --git a/sage/schemes/elliptic_curves/ell_local_data.py b/sage/schemes/elliptic_curves/ell_local_data.py
    a b  
    306306
    307307        INPUT:
    308308
    309         - ``reduce`` -- (default: True) if set to True the EC returned
    310           by Tate's algorithm will be
    311           "reduced" as specified in _reduce_model() for curves over
    312           number fields.
     309        - ``reduce`` -- (default: True) if set to True and if the initial
     310          elliptic curve had globally integral coefficients, then the
     311          elliptic curve returned by Tate's algorithm will be "reduced" as
     312          specified in _reduce_model() for curves over number fields.
    313313
    314314        EXAMPLES::
    315315
     
    342342            Elliptic Curve defined by y^2 = x^3 - x^2 - 3*x + 2 over Rational Field
    343343            sage: E.local_data(ZZ.ideal(2), algorithm="pari").minimal_model()
    344344            Elliptic Curve defined by y^2 = x^3 - x^2 - 3*x + 2 over Rational Field
     345
     346        trac 14476::
     347
     348            sage: t = QQ['t'].0
     349            sage: K.<g> = NumberField(t^4 - t^3-3*t^2 - t +1)
     350            sage: E = EllipticCurve([-2*g^3 + 10/3*g^2 + 3*g - 2/3, -11/9*g^3 + 34/9*g^2 - 7/3*g + 4/9, -11/9*g^3 + 34/9*g^2 - 7/3*g + 4/9, 0, 0])
     351            sage: vv = K.fractional_ideal(g^2 - g - 2)
     352            sage: E.local_data(vv).minimal_model()
     353            Elliptic Curve defined by y^2 + (-2*g^3+10/3*g^2+3*g-2/3)*x*y + (-11/9*g^3+34/9*g^2-7/3*g+4/9)*y = x^3 + (-11/9*g^3+34/9*g^2-7/3*g+4/9)*x^2 over Number Field in g with defining polynomial t^4 - t^3 - 3*t^2 - t + 1
     354           
    345355        """
    346356        if reduce:
    347357            try:
    348358                return self._Emin_reduced
    349359            except AttributeError:
    350360                pass
    351             self._Emin_reduced = self._Emin._reduce_model()
    352             return self._Emin_reduced
     361            # trac 14476 we only reduce if the coefficients are globally integral
     362            if all(a.is_integral() for a in self._Emin.a_invariants()):
     363                self._Emin_reduced = self._Emin._reduce_model()
     364                return self._Emin_reduced
     365            else:
     366                return self._Emin
    353367        else:
    354368            try:
    355369                return self._Emin