Ticket #7585: 7585_11_tate_ff.patch

File 7585_11_tate_ff.patch, 51.3 KB (added by David Roe, 13 years ago)
  • sage/rings/fraction_field_FpT.pyx

    # HG changeset patch
    # User Salman Baig <salmanhb@math.washington.edu>
    # Date 1259897680 18000
    # Node ID 6554460dad08185f295130ceff7d0145e9f2fbae
    # Parent  2f2e71ff8222c9bb74291bb1d1ae0a5a409d03a6
    Adds documentation for elliptic curves over F_p(t).  Fixes a latex bug in Kodaira symbol.  Moves a bunch of functions related to local data from ell_number_field to ell_global_field.  A few other miscellaneous changes related to F_p(t).
    
    diff -r 2f2e71ff8222 -r 6554460dad08 sage/rings/fraction_field_FpT.pyx
    a b  
    729729                zmod_poly_scalar_mul(x._denom, x._denom, a)
    730730        return x
    731731
     732    def valuation(self, P=None):
     733        """
     734        Return the valuation of self.
     735       
     736        EXAMPLES::
     737       
     738            sage: R.<x> = GF(5)[]
     739            sage: f = (x^3 - 1) / (x^2 + 2)
     740            sage: f.valuation(x - 1)
     741            1
     742        """
     743        return self.__numerator.valuation(P) - self.__denominator.valuation(P)
    732744       
    733745cdef class FpT_iter:
    734746    """
  • sage/rings/fraction_field_element.pyx

    diff -r 2f2e71ff8222 -r 6554460dad08 sage/rings/fraction_field_element.pyx
    a b  
    845845                (<FractionFieldElement>other).__denominator,
    846846                self.__denominator*(<FractionFieldElement>other).__numerator)
    847847
    848     def valuation(self):
     848    def valuation(self, P=None):
    849849        """
    850850        Return the valuation of self, assuming that the numerator and
    851851        denominator have valuation functions defined on them.
     
    859859            sage: f.valuation()
    860860            -1
    861861        """
    862         return self.__numerator.valuation() - self.__denominator.valuation()
     862        return self.__numerator.valuation(P) - self.__denominator.valuation(P)
    863863
    864864    def __nonzero__(self):
    865865        """
  • sage/rings/polynomial/polynomial_element.pyx

    diff -r 2f2e71ff8222 -r 6554460dad08 sage/rings/polynomial/polynomial_element.pyx
    a b  
    46614661        if isinstance(p, Polynomial):
    46624662            p = self.parent().coerce(p)
    46634663        elif is_Ideal(p) and p.ring() is self.parent():
    4664             if self.parent().is_field(): # common case
     4664            if self.parent().base_ring().is_field(): # common case
    46654665                p = p.gen()
    46664666            else:
    46674667                raise NotImplementedError
  • new file sage/schemes/elliptic_curves/ell_global_field.py

    diff -r 2f2e71ff8222 -r 6554460dad08 sage/schemes/elliptic_curves/ell_global_field.py
    - +  
     1
     2from ell_field import EllipticCurve_field
     3from constructor import EllipticCurve
     4
     5
     6class EllipticCurve_global_field(EllipticCurve_field):
     7    """
     8    Elliptic curve over a global field.
     9
     10    This class has two main subclasses: EllipticCurve_number_field and EllipticCurve_function_field.
     11
     12    We provide this common ancestor in order to support Tate's algorithm for local data, which works essentially the same in both cases.
     13
     14    EXAMPLES::
     15
     16        sage: K.<i>=NumberField(x^2+1)
     17        sage: EllipticCurve([i, i - 1, i + 1, 24*i + 15, 14*i + 35])
     18        Elliptic Curve defined by y^2 + i*x*y + (i+1)*y = x^3 + (i-1)*x^2 + (24*i+15)*x + (14*i+35) over Number Field in i with defining polynomial x^2 + 1
     19
     20        Over function fields::
     21
     22                sage: K.<t> = Frac(GF(5)['t'])
     23                sage: EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     24    """
     25    def is_local_integral_model(self,*P):
     26        r"""
     27        Tests if self is integral at the prime ideal `P`, or at all the
     28        primes if `P` is a list or tuple.
     29       
     30        INPUT:
     31
     32        - ``*P`` -- a prime ideal, or a list or tuple of primes.
     33       
     34        EXAMPLES::
     35
     36            sage: K.<i> = NumberField(x^2+1)
     37            sage: P1,P2 = K.primes_above(5)
     38            sage: E = EllipticCurve([i/5,i/5,i/5,i/5,i/5])
     39            sage: E.is_local_integral_model(P1,P2)
     40            False
     41            sage: Emin = E.local_integral_model(P1,P2)
     42            sage: Emin.is_local_integral_model(P1,P2)
     43            True
     44                       
     45                Over function fields::
     46                       
     47                        sage: K.<t> = Frac(GF(5)['t'])
     48                        sage: P1 = t+1
     49                        sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     50                        sage: E.is_local_integral_model(P1)
     51                        sage: Emin = E.local_integral_model(P1)
     52                        sage: Emin.is_local_integral_model(P1)
     53        """
     54        if len(P)==1: P=P[0]
     55        if isinstance(P,(tuple,list)):
     56            return forall(P, lambda x : self.is_local_integral_model(x))[0]
     57        return forall(self.ainvs(), lambda x : x.valuation(P) >= 0)[0]
     58
     59    def local_integral_model(self,*P):
     60        r"""
     61        Return a model of self which is integral at the prime ideal
     62        `P`.
     63
     64        .. note::
     65
     66           The integrality at other primes is not affected, even if
     67           `P` is non-principal.
     68       
     69        INPUT:
     70
     71        - ``*P`` -- a prime ideal, or a list or tuple of primes.
     72       
     73        EXAMPLES::
     74
     75            sage: K.<i> = NumberField(x^2+1)
     76            sage: P1,P2 = K.primes_above(5)
     77            sage: E = EllipticCurve([i/5,i/5,i/5,i/5,i/5])
     78            sage: E.local_integral_model((P1,P2))
     79            Elliptic Curve defined by y^2 + (-i)*x*y + (-25*i)*y = x^3 + 5*i*x^2 + 125*i*x + 3125*i over Number Field in i with defining polynomial x^2 + 1
     80
     81                Over function fields::
     82
     83                        sage: K.<t> = Frac(GF(5)['t'])
     84                        sage: P1 = t+1
     85                        sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     86                        sage: E.local_integral_model(P1)
     87        """
     88        if len(P)==1: P=P[0]
     89        if isinstance(P,(tuple,list)):
     90            E=self
     91            for Pi in P: E=E.local_integral_model(Pi)
     92            return E
     93        ai = self.a_invariants()
     94        e  = min([(ai[i].valuation(P)/[1,2,3,4,6][i]) for i in range(5)]).floor()
     95        pi = self.base_field().uniformizer(P, 'negative')
     96        return EllipticCurve([ai[i]/pi**(e*[1,2,3,4,6][i]) for i in range(5)])
     97
     98    def is_global_integral_model(self):
     99        r"""
     100        Return true iff self is integral at all primes.
     101       
     102        EXAMPLES::
     103
     104            sage: K.<i> = NumberField(x^2+1)
     105            sage: E = EllipticCurve([i/5,i/5,i/5,i/5,i/5])
     106            sage: P1,P2 = K.primes_above(5)
     107            sage: Emin = E.global_integral_model()
     108            sage: Emin.is_global_integral_model()
     109            True
     110                       
     111                Over function fields::
     112               
     113                        sage: K.<t> = Frac(GF(5)['t'])
     114                        sage: P1 = t+1
     115                        sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     116                        sage: Emin = E.global_integral_model()
     117                        sage: Emin.is_global_integral_model()
     118        """
     119        return forall(self.a_invariants(), lambda x : x.is_integral())[0]
     120
     121    def global_integral_model(self):
     122        r"""
     123        Return a model of self which is integral at all primes.
     124       
     125        EXAMPLES::
     126
     127            sage: K.<i> = NumberField(x^2+1)
     128            sage: E = EllipticCurve([i/5,i/5,i/5,i/5,i/5])
     129            sage: P1,P2 = K.primes_above(5)
     130            sage: E.global_integral_model()
     131            Elliptic Curve defined by y^2 + (-i)*x*y + (-25*i)*y = x^3 + 5*i*x^2 + 125*i*x + 3125*i over Number Field in i with defining polynomial x^2 + 1
     132
     133                Over function fields::
     134               
     135                        sage: K.<t> = Frac(GF(5)['t'])
     136                        sage: P1 = t+1
     137                        sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     138                        sage: E.global_integral_model()
     139        """
     140        K = self.base_field()
     141        ai = self.a_invariants()
     142        for a in ai:
     143            if not a.is_integral():
     144               for P, _ in K.ideal(a.denominator()).factor():
     145                   pi=K.uniformizer(P,'negative')
     146                   e  = min([(ai[i].valuation(P)/[1,2,3,4,6][i]) for i in range(5)]).floor()
     147                   ai = [ai[i]/pi**(e*[1,2,3,4,6][i]) for i in range(5)]
     148        for z in ai:
     149            assert z.denominator() == 1, "bug in global_integral_model: %s" % ai
     150        return EllipticCurve(list(ai))
     151
     152    integral_model = global_integral_model
     153
     154    def local_data(self, P=None, proof = None):
     155        r"""
     156        Local data for this elliptic curve at the prime `P`.
     157
     158        INPUT:
     159
     160        - ``P`` -- either None or a prime ideal of the base field of self.
     161
     162        - ``proof`` -- whether to only use provably correct methods
     163          (default controlled by global proof module).  Note that the
     164          proof module is number_field, not elliptic_curves, since the
     165          functions that actually need the flag are in number fields.
     166                     
     167        OUTPUT:
     168
     169        If `P` is specified, returns the ``EllipticCurveLocalData``
     170        object associated to the prime `P` for this curve.  Otherwise,
     171        returns a list of such objects, one for each prime `P` in the
     172        support of the discriminant of this model.
     173
     174        .. note::
     175
     176           The model is not required to be integral on input.
     177
     178           For principal `P`, a generator is used as a uniformizer,
     179           and integrality or minimality at other primes is not
     180           affected.  For non-principal `P`, the minimal model
     181           returned will preserve integrality at other primes, but not
     182           minimality.
     183
     184        EXAMPLES::
     185
     186            sage: K.<i> = NumberField(x^2+1)
     187            sage: E = EllipticCurve([1 + i, 0, 1, 0, 0])
     188            sage: E.local_data()
     189            [Local data at Fractional ideal (2*i + 1):
     190            Reduction type: bad non-split multiplicative
     191            Local minimal model: Elliptic Curve defined by y^2 + (i+1)*x*y + y = x^3 over Number Field in i with defining polynomial x^2 + 1
     192            Minimal discriminant valuation: 1
     193            Conductor exponent: 1
     194            Kodaira Symbol: I1
     195            Tamagawa Number: 1,
     196            Local data at Fractional ideal (-3*i - 2):
     197            Reduction type: bad split multiplicative
     198            Local minimal model: Elliptic Curve defined by y^2 + (i+1)*x*y + y = x^3 over Number Field in i with defining polynomial x^2 + 1
     199            Minimal discriminant valuation: 2
     200            Conductor exponent: 1
     201            Kodaira Symbol: I2
     202            Tamagawa Number: 2]
     203            sage: E.local_data(K.ideal(3))
     204            Local data at Fractional ideal (3):
     205            Reduction type: good
     206            Local minimal model: Elliptic Curve defined by y^2 + (i+1)*x*y + y = x^3 over Number Field in i with defining polynomial x^2 + 1
     207            Minimal discriminant valuation: 0
     208            Conductor exponent: 0
     209            Kodaira Symbol: I0
     210            Tamagawa Number: 1
     211
     212        An example raised in \#3897::
     213
     214            sage: E = EllipticCurve([1,1])
     215            sage: E.local_data(3)
     216            Local data at Principal ideal (3) of Integer Ring:
     217            Reduction type: good
     218            Local minimal model: Elliptic Curve defined by y^2 = x^3 + x + 1 over Rational Field
     219            Minimal discriminant valuation: 0
     220            Conductor exponent: 0
     221            Kodaira Symbol: I0
     222            Tamagawa Number: 1
     223                       
     224                Over function fields::
     225               
     226                        sage: K.<t> = Frac(GF(5)['t'])
     227                        sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     228                        sage: E.local_data()
     229        """
     230        if proof is None:
     231            import sage.structure.proof.proof
     232            # We use the "number_field" flag because the actual proof dependence is in Pari's number field functions.
     233            proof = sage.structure.proof.proof.get_flag(None, "number_field")
     234
     235        if P is None:
     236            primes = self.base_ring()(self.discriminant()).support()
     237            return [self._get_local_data(pr, proof) for pr in primes]
     238
     239        from sage.schemes.elliptic_curves.ell_local_data import check_prime
     240        P = check_prime(self.base_field(),P)
     241
     242        return self._get_local_data(P,proof)       
     243
     244    def _get_local_data(self, P, proof):
     245        r"""
     246        Internal function to create data for this elliptic curve at the prime `P`.
     247       
     248        This function handles the caching of local data.  It is called
     249        by local_data() which is the user interface and which parses
     250        the input parameters `P` and proof.
     251       
     252        INPUT:
     253
     254        - ``P`` -- either None or a prime ideal of the base field of self.
     255
     256        - ``proof`` -- whether to only use provably correct methods
     257          (default controlled by global proof module).  Note that the
     258          proof module is number_field, not elliptic_curves, since the
     259          functions that actually need the flag are in number fields.
     260                     
     261        EXAMPLES::
     262
     263            sage: K.<i> = NumberField(x^2+1)
     264            sage: E = EllipticCurve(K,[0,1,0,-160,308])
     265            sage: p = K.ideal(i+1)
     266            sage: E._get_local_data(p, False)
     267            Local data at Fractional ideal (i + 1):
     268            Reduction type: good
     269            Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 + (-10)*x + (-10) over Number Field in i with defining polynomial x^2 + 1
     270            Minimal discriminant valuation: 0
     271            Conductor exponent: 0
     272            Kodaira Symbol: I0
     273            Tamagawa Number: 1
     274           
     275        Verify that we cache based on the proof value::
     276
     277            sage: E._get_local_data(p, False) is E._get_local_data(p, True)
     278            False
     279                       
     280                Over function fields::
     281               
     282                        sage: K.<t> = Frac(GF(5)['t'])
     283                        sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     284                        sage: p = K.ideal(t+1)
     285                        sage: Emin = E._get_local_data(p, False)
     286            sage: E._get_local_data(p, False) is E._get_local_data(p, True)
     287        """
     288        try:
     289            return self._local_data[P, proof]
     290        except AttributeError:
     291            self._local_data = {}
     292        except KeyError:
     293            pass
     294        from sage.schemes.elliptic_curves.ell_local_data import EllipticCurveLocalData   
     295        self._local_data[P, proof] = EllipticCurveLocalData(self, P, proof)
     296        return self._local_data[P, proof]       
     297
     298    def local_minimal_model(self, P, proof = None):
     299        r"""
     300        Returns a model which is integral at all primes and minimal at `P`.
     301
     302        INPUT:
     303
     304        - ``P`` -- either None or a prime ideal of the base field of self.
     305
     306        - ``proof`` -- whether to only use provably correct methods
     307          (default controlled by global proof module).  Note that the
     308          proof module is number_field, not elliptic_curves, since the
     309          functions that actually need the flag are in number fields.
     310                     
     311        OUTPUT:
     312
     313        A model of the curve which is minimal (and integral) at `P`.
     314
     315        .. note::
     316
     317           The model is not required to be integral on input.
     318
     319           For principal `P`, a generator is used as a uniformizer,
     320           and integrality or minimality at other primes is not
     321           affected.  For non-principal `P`, the minimal model
     322           returned will preserve integrality at other primes, but not
     323           minimality.
     324
     325        EXAMPLES::
     326
     327            sage: K.<a>=NumberField(x^2-5)
     328            sage: E=EllipticCurve([20, 225, 750, 625*a + 6875, 31250*a + 46875])
     329            sage: P=K.ideal(a)
     330            sage: E.local_minimal_model(P).ainvs()
     331            (0, 1, 0, a - 33, -2*a + 64)
     332                       
     333                Over function fields::
     334               
     335                        sage: K.<t> = Frac(GF(5)['t'])
     336                        sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     337                        sage: P = K.ideal(t+1)
     338                        sage: E.local_minimal_model(P).ainvs()
     339        """
     340        if proof is None:
     341            import sage.structure.proof.proof
     342            # We use the "number_field" flag because the actual proof dependence is in Pari's number field functions.
     343            proof = sage.structure.proof.proof.get_flag(None, "number_field")
     344
     345        return self.local_data(P, proof).minimal_model()
     346
     347    def has_good_reduction(self, P):
     348        r"""
     349        Return True if this elliptic curve has good reduction at the prime `P`.
     350
     351        INPUT:
     352
     353        - ``P`` -- a prime ideal of the base field of self, or a field
     354          element generating such an ideal.
     355           
     356        OUTPUT:
     357       
     358        (bool) -- True if the curve has good reduction at `P`, else False.
     359
     360        .. note::
     361
     362           This requires determining a local integral minimal model;
     363           we do not just check that the discriminant of the current
     364           model has valuation zero.
     365
     366        EXAMPLES::
     367
     368            sage: E=EllipticCurve('14a1')
     369            sage: [(p,E.has_good_reduction(p)) for p in prime_range(15)]
     370            [(2, False), (3, True), (5, True), (7, False), (11, True), (13, True)]
     371   
     372            sage: K.<a>=NumberField(x^3-2)
     373            sage: P17a, P17b = [P for P,e in K.factor(17)]
     374            sage: E = EllipticCurve([0,0,0,0,2*a+1])
     375            sage: [(p,E.has_good_reduction(p)) for p in [P17a,P17b]]           
     376            [(Fractional ideal (4*a^2 - 2*a + 1), True),
     377            (Fractional ideal (2*a + 1), False)]
     378               
     379                Over function fields::
     380               
     381                        sage: K.<t> = Frac(GF(5)['t'])
     382                        sage: p, q, r = t, t+1, t+2
     383                        sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     384                        sage: [(P, E.has_good_reduction(P)) for P in [p,q,r]]
     385        """   
     386        return self.local_data(P).has_good_reduction()
     387       
     388    def has_bad_reduction(self, P):
     389        r"""
     390        Return True if this elliptic curve has bad reduction at the prime `P`.
     391
     392        INPUT:
     393
     394        - ``P`` -- a prime ideal of the base field of self, or a field
     395          element generating such an ideal.
     396           
     397        OUTPUT:
     398
     399        (bool) True if the curve has bad reduction at `P`, else False.
     400
     401        .. note::
     402
     403           This requires determining a local integral minimal model;
     404           we do not just check that the discriminant of the current
     405           model has valuation zero.
     406
     407        EXAMPLES::
     408
     409            sage: E=EllipticCurve('14a1')
     410            sage: [(p,E.has_bad_reduction(p)) for p in prime_range(15)]
     411            [(2, True), (3, False), (5, False), (7, True), (11, False), (13, False)]
     412 
     413            sage: K.<a>=NumberField(x^3-2)
     414            sage: P17a, P17b = [P for P,e in K.factor(17)]
     415            sage: E = EllipticCurve([0,0,0,0,2*a+1])
     416            sage: [(p,E.has_bad_reduction(p)) for p in [P17a,P17b]]           
     417            [(Fractional ideal (4*a^2 - 2*a + 1), False),
     418            (Fractional ideal (2*a + 1), True)]
     419                       
     420                Over function fields::
     421               
     422                        sage: K.<t> = Frac(GF(5)['t'])
     423                        sage: p, q, r = t, t+1, t+2
     424                        sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     425                        sage: [(P, E.has_bad_reduction(P)) for P in [p,q,r]]
     426        """
     427        return self.local_data(P).has_bad_reduction()
     428       
     429    def has_multiplicative_reduction(self, P):
     430        r"""
     431        Return True if this elliptic curve has (bad) multiplicative reduction at the prime `P`.
     432
     433        .. note::
     434
     435           See also ``has_split_multiplicative_reduction()`` and
     436           ``has_nonsplit_multiplicative_reduction()``.
     437
     438        INPUT:
     439
     440        - ``P`` -- a prime ideal of the base field of self, or a field
     441                 element generating such an ideal.
     442           
     443        OUTPUT:
     444
     445        (bool) True if the curve has multiplicative reduction at `P`,
     446        else False.
     447
     448        EXAMPLES::
     449
     450            sage: E=EllipticCurve('14a1')
     451            sage: [(p,E.has_multiplicative_reduction(p)) for p in prime_range(15)]
     452            [(2, True), (3, False), (5, False), (7, True), (11, False), (13, False)]
     453 
     454            sage: K.<a>=NumberField(x^3-2)
     455            sage: P17a, P17b = [P for P,e in K.factor(17)]
     456            sage: E = EllipticCurve([0,0,0,0,2*a+1])
     457            sage: [(p,E.has_multiplicative_reduction(p)) for p in [P17a,P17b]]           
     458            [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)]
     459                       
     460                Over function fields::
     461               
     462                        sage: K.<t> = Frac(GF(5)['t'])
     463                        sage: p, q, r = t, t+1, t+2
     464                        sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     465                        sage: [(P, E.has_multiplicative_reduction(P)) for P in [p,q,r]]
     466        """
     467        return self.local_data(P).has_multiplicative_reduction()
     468       
     469    def has_split_multiplicative_reduction(self, P):
     470        r"""
     471        Return True if this elliptic curve has (bad) split multiplicative reduction at the prime `P`.
     472
     473        INPUT:
     474
     475        - ``P`` -- a prime ideal of the base field of self, or a field
     476          element generating such an ideal.
     477           
     478        OUTPUT:
     479
     480        (bool) True if the curve has split multiplicative reduction at
     481        `P`, else False.
     482
     483        EXAMPLES::
     484
     485            sage: E=EllipticCurve('14a1')
     486            sage: [(p,E.has_split_multiplicative_reduction(p)) for p in prime_range(15)]
     487            [(2, False), (3, False), (5, False), (7, True), (11, False), (13, False)]
     488 
     489            sage: K.<a>=NumberField(x^3-2)
     490            sage: P17a, P17b = [P for P,e in K.factor(17)]
     491            sage: E = EllipticCurve([0,0,0,0,2*a+1])
     492            sage: [(p,E.has_split_multiplicative_reduction(p)) for p in [P17a,P17b]]           
     493            [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)]
     494                       
     495                Over function fields::
     496               
     497                        sage: K.<t> = Frac(GF(5)['t'])
     498                        sage: p, q, r = t, t+1, t+2
     499                        sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     500                        sage: [(P, E.has_split_multiplicative_reduction(P)) for P in [p,q,r]]
     501        """
     502        return self.local_data(P).has_split_multiplicative_reduction()
     503       
     504    def has_nonsplit_multiplicative_reduction(self, P):
     505        r"""
     506        Return True if this elliptic curve has (bad) non-split multiplicative reduction at the prime `P`.
     507
     508        INPUT:
     509
     510        - ``P`` -- a prime ideal of the base field of self, or a field
     511          element generating such an ideal.
     512           
     513        OUTPUT:
     514
     515        (bool) True if the curve has non-split multiplicative
     516        reduction at `P`, else False.
     517
     518        EXAMPLES::
     519
     520            sage: E=EllipticCurve('14a1')
     521            sage: [(p,E.has_nonsplit_multiplicative_reduction(p)) for p in prime_range(15)]
     522            [(2, True), (3, False), (5, False), (7, False), (11, False), (13, False)]
     523 
     524            sage: K.<a>=NumberField(x^3-2)
     525            sage: P17a, P17b = [P for P,e in K.factor(17)]
     526            sage: E = EllipticCurve([0,0,0,0,2*a+1])
     527            sage: [(p,E.has_nonsplit_multiplicative_reduction(p)) for p in [P17a,P17b]]           
     528            [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)]
     529                       
     530                Over function fields::
     531               
     532                        sage: K.<t> = Frac(GF(5)['t'])
     533                        sage: p, q, r = t, t+1, t+2
     534                        sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     535                        sage: [(P, E.has_nonsplit_multiplicative_reduction(P)) for P in [p,q,r]]
     536        """
     537        return self.local_data(P).has_nonsplit_multiplicative_reduction()
     538       
     539    def has_additive_reduction(self, P):
     540        r"""
     541        Return True if this elliptic curve has (bad) additive reduction at the prime `P`.
     542
     543        INPUT:
     544       
     545        - ``P`` -- a prime ideal of the base field of self, or a field
     546          element generating such an ideal.
     547           
     548        OUTPUT:
     549
     550        (bool) True if the curve has additive reduction at `P`, else False.
     551
     552        EXAMPLES::
     553
     554            sage: E=EllipticCurve('27a1')
     555            sage: [(p,E.has_additive_reduction(p)) for p in prime_range(15)]
     556            [(2, False), (3, True), (5, False), (7, False), (11, False), (13, False)]
     557 
     558            sage: K.<a>=NumberField(x^3-2)
     559            sage: P17a, P17b = [P for P,e in K.factor(17)]
     560            sage: E = EllipticCurve([0,0,0,0,2*a+1])
     561            sage: [(p,E.has_additive_reduction(p)) for p in [P17a,P17b]]           
     562            [(Fractional ideal (4*a^2 - 2*a + 1), False),
     563            (Fractional ideal (2*a + 1), True)]
     564                       
     565                Over function fields::
     566               
     567                        sage: K.<t> = Frac(GF(5)['t'])
     568                        sage: p, q, r = t, t+1, t+2
     569                        sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     570                        sage: [(P, E.has_additive_reduction(P)) for P in [p,q,r]]
     571        """
     572        return self.local_data(P).has_additive_reduction()
     573       
     574    def tamagawa_number(self, P, proof = None):
     575        r"""
     576        Returns the Tamagawa number of this elliptic curve at the prime `P`.
     577
     578        INPUT:
     579
     580        - ``P`` -- either None or a prime ideal of the base field of self.
     581
     582        - ``proof`` -- whether to only use provably correct methods
     583          (default controlled by global proof module).  Note that the
     584          proof module is number_field, not elliptic_curves, since the
     585          functions that actually need the flag are in number fields.
     586                     
     587        OUTPUT:
     588
     589        (positive integer) The Tamagawa number of the curve at `P`.
     590
     591        EXAMPLES::
     592
     593            sage: K.<a>=NumberField(x^2-5)
     594            sage: E=EllipticCurve([20, 225, 750, 625*a + 6875, 31250*a + 46875])
     595            sage: [E.tamagawa_number(P) for P in E.discriminant().support()]
     596            [1, 1, 1, 1]
     597            sage: K.<a> = QuadraticField(-11)
     598            sage: E = EllipticCurve('11a1').change_ring(K)
     599            sage: [E.tamagawa_number(P) for P in K(11).support()]
     600            [10]
     601                                       
     602                Over function fields::
     603               
     604                        sage: K.<t> = Frac(GF(5)['t'])
     605                        sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     606                        sage: [E.tamagawa_number(P) for P in E.discriminant().support()]
     607        """
     608        if proof is None:
     609            import sage.structure.proof.proof
     610            # We use the "number_field" flag because the actual proof dependence is in Pari's number field functions.
     611            proof = sage.structure.proof.proof.get_flag(None, "number_field")
     612
     613        return self.local_data(P, proof).tamagawa_number()
     614
     615    def tamagawa_exponent(self, P, proof = None):
     616        r"""
     617        Returns the Tamagawa index of this elliptic curve at the prime `P`.
     618
     619        INPUT:
     620
     621        - ``P`` -- either None or a prime ideal of the base field of self.
     622
     623        - ``proof`` -- whether to only use provably correct methods
     624          (default controlled by global proof module).  Note that the
     625          proof module is number_field, not elliptic_curves, since the
     626          functions that actually need the flag are in number fields.
     627                     
     628        OUTPUT:
     629
     630        (positive integer) The Tamagawa index of the curve at P.
     631
     632        EXAMPLES::
     633
     634            sage: K.<a>=NumberField(x^2-5)
     635            sage: E=EllipticCurve([20, 225, 750, 625*a + 6875, 31250*a + 46875])
     636            sage: [E.tamagawa_exponent(P) for P in E.discriminant().support()]
     637            [1, 1, 1, 1]
     638            sage: K.<a> = QuadraticField(-11)
     639            sage: E = EllipticCurve('11a1').change_ring(K)
     640            sage: [E.tamagawa_exponent(P) for P in K(11).support()]
     641            [10]
     642                       
     643                Over function fields::
     644               
     645                        sage: K.<t> = Frac(GF(5)['t'])
     646                        sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     647                        sage: [E.tamagawa_exponent(P) for P in E.discriminant().support()]
     648        """
     649        if proof is None:
     650            import sage.structure.proof.proof
     651            # We use the "number_field" flag because the actual proof dependence is in Pari's number field functions.
     652            proof = sage.structure.proof.proof.get_flag(None, "number_field")
     653
     654        return self.local_data(P, proof).tamagawa_exponent()
     655
     656    def kodaira_symbol(self, P, proof = None):
     657        r"""
     658        Returns the Kodaira Symbol of this elliptic curve at the prime `P`.
     659
     660        INPUT:
     661
     662        - ``P`` -- either None or a prime ideal of the base field of self.
     663
     664        - ``proof`` -- whether to only use provably correct methods
     665          (default controlled by global proof module).  Note that the
     666          proof module is number_field, not elliptic_curves, since the
     667          functions that actually need the flag are in number fields.
     668                     
     669        OUTPUT:
     670           
     671        (string) The Kodaira Symbol of the curve at P.
     672
     673        EXAMPLES::
     674
     675            sage: K.<a>=NumberField(x^2-5)
     676            sage: E=EllipticCurve([20, 225, 750, 625*a + 6875, 31250*a + 46875])
     677            sage: bad_primes = E.discriminant().support(); bad_primes
     678            [Fractional ideal (-a),
     679            Fractional ideal (7/2*a - 81/2),
     680            Fractional ideal (a + 52),
     681            Fractional ideal (2)]
     682            sage: [E.kodaira_symbol(P) for P in bad_primes]
     683            [I0, I1, I1, II]
     684            sage: K.<a> = QuadraticField(-11)
     685            sage: E = EllipticCurve('11a1').change_ring(K)
     686            sage: [E.kodaira_symbol(P) for P in K(11).support()]
     687            [I10]
     688                       
     689                Over function fields::
     690               
     691                        sage: K.<t> = Frac(GF(5)['t'])
     692                        sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     693                        sage: bad_primes = E.discriminant().support(); bad_primes
     694                        sage: [E.kodaira_symbol(P) for P in bad_primes]                 
     695        """
     696        if proof is None:
     697            import sage.structure.proof.proof
     698            # We use the "number_field" flag because the actual proof dependence is in Pari's number field functions.
     699            proof = sage.structure.proof.proof.get_flag(None, "number_field")
     700
     701        return self.local_data(P, proof).kodaira_symbol()
     702
     703
     704    def conductor(self):
     705        r"""
     706        Returns the conductor of this elliptic curve as a fractional
     707        ideal of the base field.
     708
     709        OUTPUT:
     710
     711        (fractional ideal) The conductor of the curve.
     712
     713        EXAMPLES::
     714
     715            sage: K.<i>=NumberField(x^2+1)
     716            sage: EllipticCurve([i, i - 1, i + 1, 24*i + 15, 14*i + 35]).conductor()
     717            Fractional ideal (21*i - 3)
     718            sage: K.<a>=NumberField(x^2-x+3)
     719            sage: EllipticCurve([1 + a , -1 + a , 1 + a , -11 + a , 5 -9*a  ]).conductor()
     720            Fractional ideal (-6*a)
     721
     722        A not so well known curve with everywhere good reduction::
     723
     724            sage: K.<a>=NumberField(x^2-38)
     725            sage: E=EllipticCurve([0,0,0, 21796814856932765568243810*a - 134364590724198567128296995, 121774567239345229314269094644186997594*a - 750668847495706904791115375024037711300])
     726            sage: E.conductor()
     727            Fractional ideal (1)
     728
     729        An example which used to fail (see trac #5307)::
     730
     731            sage: K.<w>=NumberField(x^2+x+6)
     732            sage: E=EllipticCurve([w,-1,0,-w-6,0])
     733            sage: E.conductor()
     734            Fractional ideal (86304, w + 5898)
     735
     736                Over function fields::
     737               
     738                        sage: K.<t> = Frac(GF(5)['t'])
     739                        sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     740                        sage: E.conductor()
     741        """
     742        try:
     743            return self._conductor
     744        except AttributeError:
     745            pass
     746
     747        # Note: for number fields other than QQ we could initialize
     748        # N=K.ideal(1) or N=OK.ideal(1), which are the same, but for
     749        # K==QQ it has to be ZZ.ideal(1).
     750        OK = self.base_ring().ring_of_integers()
     751        self._conductor = prod([d.prime()**(d.conductor_valuation()) \
     752                                for d in self.local_data()],\
     753                               OK.ideal(1))
     754        return self._conductor
     755
     756    def global_minimal_model(self, proof = None):
     757        r"""
     758        Returns a model of self that is integral, minimal at all primes.
     759       
     760        .. note::
     761
     762           This is only implemented for class number 1.  In general,
     763           such a model may or may not exist.
     764       
     765        INPUT:
     766
     767        - ``proof`` -- whether to only use provably correct methods
     768          (default controlled by global proof module).  Note that the
     769          proof module is number_field, not elliptic_curves, since the
     770          functions that actually need the flag are in number fields.
     771
     772        OUTPUT:
     773
     774        A global integral and minimal model.
     775
     776        EXAMPLES::
     777
     778            sage: K.<a> = NumberField(x^2-38)
     779            sage: E = EllipticCurve([0,0,0, 21796814856932765568243810*a - 134364590724198567128296995, 121774567239345229314269094644186997594*a - 750668847495706904791115375024037711300])
     780            sage: E.global_minimal_model()
     781            Elliptic Curve defined by y^2 + a*x*y + (a+1)*y = x^3 + (a+1)*x^2 + (368258520200522046806318444*a-2270097978636731786720859345)*x + (8456608930173478039472018047583706316424*a-52130038506793883217874390501829588391299) over Number Field in a with defining polynomial x^2 - 38
     782
     783                Over function fields::
     784               
     785                        sage: K.<t> = Frac(GF(5)['t'])
     786                        sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     787                        sage: E.global_minimal_model()
     788        """
     789        if proof is None:
     790            import sage.structure.proof.proof
     791            # We use the "number_field" flag because the actual proof dependence is in Pari's number field functions.
     792            proof = sage.structure.proof.proof.get_flag(None, "number_field")
     793        K = self.base_ring()
     794        if K.class_number() != 1:
     795            raise ValueError, "global minimal models only exist in general for class number 1"
     796
     797        E = self.global_integral_model()
     798        primes = self.base_ring()(self.discriminant()).support()
     799        for P in primes:
     800            E = E.local_data(P,proof).minimal_model()
     801        return E._tidy_model()
     802
     803    def reduction(self,place):
     804       r"""
     805       Return the reduction of the elliptic curve at a place of good reduction.
     806       
     807       INPUT:
     808
     809       - ``place`` -- a prime ideal in the base field of the curve
     810           
     811       OUTPUT:
     812
     813       An elliptic curve over a finite field, the residue field of the place.
     814
     815       EXAMPLES::
     816
     817           sage: K.<i> = QuadraticField(-1)
     818           sage: EK = EllipticCurve([0,0,0,i,i+3])
     819           sage: v = K.fractional_ideal(2*i+3)
     820           sage: EK.reduction(v)
     821           Elliptic Curve defined by y^2  = x^3 + 5*x + 8 over Residue field of Fractional ideal (2*i + 3)
     822           sage: EK.reduction(K.ideal(1+i))     
     823           Traceback (most recent call last):
     824           ... 
     825           AttributeError: The curve must have good reduction at the place.
     826           sage: EK.reduction(K.ideal(2)) 
     827           Traceback (most recent call last):
     828           ... 
     829           AttributeError: The ideal must be prime.
     830
     831                Over function fields::
     832               
     833                        sage: K.<t> = Frac(GF(5)['t'])
     834                        sage: p = t+2
     835                        sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     836                        sage: E.reduction(p)
     837                        sage: E.reduction(t)
     838       """
     839       K = self.base_field()
     840       OK = K.ring_of_integers()
     841       try:
     842           place = K.ideal(place)
     843       except TypeError:
     844           raise TypeError, "The parameter must be an ideal of the base field of the elliptic curve"
     845       if not place.is_prime():
     846           raise AttributeError, "The ideal must be prime."
     847       disc = self.discriminant()
     848       if not K.ideal(disc).valuation(place) == 0:
     849           raise AttributeError, "The curve must have good reduction at the place."
     850       Fv = OK.residue_field(place)
     851       return self.change_ring(Fv)
  • sage/schemes/elliptic_curves/ell_local_data.py

    diff -r 2f2e71ff8222 -r 6554460dad08 sage/schemes/elliptic_curves/ell_local_data.py
    a b  
    2727from sage.misc.misc import verbose, forall
    2828
    2929from sage.rings.all import PolynomialRing, QQ, ZZ, Integer, is_Ideal, is_NumberFieldElement, is_NumberFieldFractionalIdeal, is_NumberField
     30from sage.rings.polynomial.polynomial_ring import is_PolynomialRing
    3031from sage.structure.element import RingElement
    3132from constructor import EllipticCurve
    3233from kodaira_symbol import KodairaSymbol
     
    131132            Conductor exponent: 1
    132133            Kodaira Symbol: I3
    133134            Tamagawa Number: 3
     135
     136        Over function fields::
     137               
     138            sage: K.<t> = Frac(GF(5)['t'])
     139            sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     140            sage: EllipticCurveLocalData(E,t)
    134141        """
    135142        self._curve = E
    136143        K = E.base_field()
     
    179186            'Local data at Principal ideal (3) of Integer Ring:\nReduction type: good\nLocal minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field\nMinimal discriminant valuation: 0\nConductor exponent: 0\nKodaira Symbol: I0\nTamagawa Number: 1'
    180187            sage: EllipticCurveLocalData(E,7).__repr__()
    181188            'Local data at Principal ideal (7) of Integer Ring:\nReduction type: bad split multiplicative\nLocal minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field\nMinimal discriminant valuation: 3\nConductor exponent: 1\nKodaira Symbol: I3\nTamagawa Number: 3'
     189
     190        Over function fields::
     191               
     192            sage: K.<t> = Frac(GF(5)['t'])
     193            sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     194            sage: EllipticCurveLocalData(E,t).__repr__()
    182195        """
    183196        red_type = "good"
    184197        if not self._reduction_type is None:
     
    199212            Elliptic Curve defined by y^2 = x^3 + 1 over Rational Field
    200213            sage: data.minimal_model() == E.local_minimal_model(2)
    201214            True
     215
     216        Over function fields::
     217               
     218            sage: K.<t> = Frac(GF(5)['t'])
     219            sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     220            sage: data = EllipticCurveLocalData(E,t)
     221            sage: data.minimal_model()
     222            sage: data.minimal_model() == E.local_minimal_model(t)
    202223        """
    203224        return self._Emin
    204225
     
    214235            sage: data = EllipticCurveLocalData(E,2)
    215236            sage: data.prime()
    216237            Principal ideal (2) of Integer Ring
     238
     239        Over function fields::
     240               
     241            sage: K.<t> = Frac(GF(5)['t'])
     242            sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     243            sage: data = EllipticCurveLocalData(E,t)
     244            sage: data.prime()
    217245        """
    218246        return self._prime
    219247
     
    229257            sage: data = EllipticCurveLocalData(E,2)
    230258            sage: data.conductor_valuation()
    231259            2
     260
     261        Over function fields::
     262               
     263            sage: K.<t> = Frac(GF(5)['t'])
     264            sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     265            sage: data = EllipticCurveLocalData(E,t)
     266            sage: data.conductor_valuation()
    232267        """
    233268        return self._fp
    234269
     
    244279            sage: data = EllipticCurveLocalData(E,2)
    245280            sage: data.kodaira_symbol()
    246281            IV
     282
     283        Over function fields::
     284               
     285            sage: K.<t> = Frac(GF(5)['t'])
     286            sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     287            sage: data = EllipticCurveLocalData(E,t)
     288            sage: data.kodaira_symbol()
    247289        """
    248290        return self._KS
    249291
     
    261303            sage: data = EllipticCurveLocalData(E,2)
    262304            sage: data.tamagawa_number()
    263305            3
     306
     307        Over function fields::
     308               
     309            sage: K.<t> = Frac(GF(5)['t'])
     310            sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     311            sage: data = EllipticCurveLocalData(E,t)
     312            sage: data.tamagawa_number()
    264313        """
    265314        return self._cp
    266315
     
    291340            4
    292341            sage: data.tamagawa_exponent()
    293342            2
     343
     344        Over function fields::
     345               
     346            sage: K.<t> = Frac(GF(5)['t'])
     347            sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     348            sage: data = EllipticCurveLocalData(E,t)
     349            sage: data.kodaira_symbol()
     350            sage: data.tamagawa_number()
     351            sage: data.tamagawa_exponent()
    294352        """
    295353        cp = self._cp
    296354        if cp!=4:
     
    324382            sage: E = EllipticCurve([0,0,0,0,2*a+1])
    325383            sage: [(p,E.local_data(p).bad_reduction_type()) for p in [P17a,P17b]]           
    326384            [(Fractional ideal (4*a^2 - 2*a + 1), None), (Fractional ideal (2*a + 1), 0)]
    327        """
     385
     386        Over function fields::
     387               
     388            sage: K.<t> = Frac(GF(5)['t'])
     389            sage: p, q = t, t+1
     390            sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     391            sage: [(P, E.local_data(P).bad_reduction_type()) for P in [p,q]]
     392        """
    328393        return self._reduction_type
    329394   
    330395    def has_good_reduction(self):
     
    343408            sage: [(p,E.local_data(p).has_good_reduction()) for p in [P17a,P17b]]           
    344409            [(Fractional ideal (4*a^2 - 2*a + 1), True),
    345410            (Fractional ideal (2*a + 1), False)]
     411
     412        Over function fields::
     413               
     414            sage: K.<t> = Frac(GF(5)['t'])
     415            sage: p, q = t+1, t+2
     416            sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     417            sage: [(P, E.local_data(P).has_good_reduction()) for P in [p,q]]
    346418        """
    347419        return self._reduction_type is None
    348420       
     
    364436            sage: [(p,E.local_data(p).has_bad_reduction()) for p in [P17a,P17b]]           
    365437            [(Fractional ideal (4*a^2 - 2*a + 1), False),
    366438            (Fractional ideal (2*a + 1), True)]
     439
     440        Over function fields::
     441               
     442            sage: K.<t> = Frac(GF(5)['t'])
     443            sage: p, q = t+1, t+2
     444            sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     445            sage: [(P, E.local_data(P).has_bad_reduction()) for P in [p,q]]
    367446        """
    368447        return not self._reduction_type is None
    369448       
     
    389468            sage: E = EllipticCurve([0,0,0,0,2*a+1])
    390469            sage: [(p,E.local_data(p).has_multiplicative_reduction()) for p in [P17a,P17b]]           
    391470            [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)]
     471
     472        Over function fields::
     473               
     474            sage: K.<t> = Frac(GF(5)['t'])
     475            sage: p, q = t, t+1
     476            sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     477            sage: [(P, E.local_data(P).has_multiplicative_reduction()) for P in [p,q]]
    392478        """
    393479        return self._reduction_type in (-1,+1)
    394480       
     
    410496            sage: [(p,E.local_data(p).has_split_multiplicative_reduction()) for p in [P17a,P17b]]           
    411497            [(Fractional ideal (4*a^2 - 2*a + 1), False),
    412498            (Fractional ideal (2*a + 1), False)]
     499
     500        Over function fields::
     501               
     502            sage: K.<t> = Frac(GF(5)['t'])
     503            sage: p, q = t, t+1
     504            sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     505            sage: [(P, E.local_data(P).has_split_multiplicative_reduction()) for P in [p,q]]
    413506        """
    414507        return self._reduction_type == +1
    415508       
     
    430523            sage: E = EllipticCurve([0,0,0,0,2*a+1])
    431524            sage: [(p,E.local_data(p).has_nonsplit_multiplicative_reduction()) for p in [P17a,P17b]]           
    432525            [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)]
     526
     527        Over function fields::
     528               
     529            sage: K.<t> = Frac(GF(5)['t'])
     530            sage: p, q = t, t+1
     531            sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     532            sage: [(P, E.local_data(P).has_nonsplit_multiplicative_reduction()) for P in [p,q]]
    433533        """
    434534        return self._reduction_type == -1
    435535       
     
    451551            sage: [(p,E.local_data(p).has_additive_reduction()) for p in [P17a,P17b]]           
    452552            [(Fractional ideal (4*a^2 - 2*a + 1), False),
    453553            (Fractional ideal (2*a + 1), True)]
     554
     555        Over function fields::
     556               
     557            sage: K.<t> = Frac(GF(5)['t'])
     558            sage: p, q = t, t+1
     559            sage: E = EllipticCurve(K,[0,0,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(2*t^6-3*t^5-3*t^4+2*t^3)])
     560            sage: [(P, E.local_data(P).has_additive_reduction()) for P in [p,q]]
    454561        """
    455562        return self._reduction_type == 0
    456563       
     
    509616            pi = K.uniformizer(P, 'positive')
    510617            verbose("P is not principal, uniformizer pi = %s"%pi, t, 1)
    511618        pi2 = pi*pi; pi3 = pi*pi2; pi4 = pi*pi3
    512         prime = pi if K is QQ else P
     619        prime = pi if (K is QQ or is_PolynomialRing(OK)) else P
    513620
    514621        pval = lambda x: x.valuation(prime)
    515622        pdiv = lambda x: x.is_zero() or pval(x) > 0
     
    865972        Fractional ideal (a + 1)
    866973        sage: [check_prime(K,P) for P in K.primes_above(31)]
    867974        [Fractional ideal (-5/2*a - 1/2), Fractional ideal (-5/2*a + 1/2)]
     975
     976        Over function fields::
     977               
     978                sage: K.<t> = Frac(GF(5)['t'])
     979                sage: R = K.ring_of_integers()
     980                sage: check_prime(K,R.ideal(t))
    868981    """
    869982    if K is QQ:
    870983        if isinstance(P, (int,long,Integer)):
  • sage/schemes/elliptic_curves/ell_number_field.py

    diff -r 2f2e71ff8222 -r 6554460dad08 sage/schemes/elliptic_curves/ell_number_field.py
    a b  
    3131#                  http://www.gnu.org/licenses/
    3232#*****************************************************************************
    3333
    34 from ell_field import EllipticCurve_field
    3534import ell_point
    3635from sage.rings.ring import Ring
    3736from sage.rings.arith import lcm, gcd
     
    4140
    4241from gp_simon import simon_two_descent
    4342from constructor import EllipticCurve
     43from ell_global_field import EllipticCurve_global_field
    4444from sage.rings.all import PolynomialRing, QQ, ZZ, is_Ideal, is_NumberFieldElement, is_NumberFieldFractionalIdeal
    4545from sage.misc.misc import verbose, forall
    4646from sage.misc.functional import ideal
     
    4949from sage.structure.element import RingElement
    5050from sage.rings.infinity import Infinity # just for verbose output
    5151
    52 class EllipticCurve_number_field(EllipticCurve_field):
     52class EllipticCurve_number_field(EllipticCurve_global_field):
    5353    """
    5454    Elliptic curve over a number field.
    5555
     
    9797        if not (isinstance(field, Ring) and isinstance(ainvs,list)):
    9898            raise TypeError
    9999       
    100         EllipticCurve_field.__init__(self, [field(x) for x in ainvs])
     100        EllipticCurve_global_field.__init__(self, [field(x) for x in ainvs])
    101101        self._point_class = ell_point.EllipticCurvePoint_number_field
    102102
    103103    def simon_two_descent(self, verbose=0, lim1=5, lim3=50, limtriv=10, maxprob=20, limbigprime=30):
  • sage/schemes/elliptic_curves/kodaira_symbol.py

    diff -r 2f2e71ff8222 -r 6554460dad08 sage/schemes/elliptic_curves/kodaira_symbol.py
    a b  
    101101                self._n = 0
    102102                self._roman = 1
    103103                self._str = 'I0'
    104                 self._latex = '$I_0$'
     104                self._latex = 'I_0'
    105105            elif n == 2:
    106106                self._roman = 2
    107107                self._str = 'II'
    108                 self._latex = '$II$'
     108                self._latex = 'II'
    109109            elif n == 3:
    110110                self._roman = 3
    111111                self._str = 'III'
    112                 self._latex = '$III$'
     112                self._latex = 'III'
    113113            elif n == 4:
    114114                self._roman = 4
    115115                self._str = 'IV'
    116                 self._latex = '$IV$'
     116                self._latex = 'IV'
    117117            elif n > 4:
    118118                nu = n - 4
    119119                self._n = nu
    120120                self._roman = 1
    121121                self._str = 'I' + nu.str()
    122                 self._latex = '$I_{' + nu.str() + '}$'
     122                self._latex = 'I_{' + nu.str() + '}'
    123123            elif n == -1:
    124124                self._roman = 1
    125125                self._n = 0
    126126                self._str = 'I0*'
    127                 self._latex = '$I_0^{*}$'
     127                self._latex = 'I_0^{*}'
    128128            elif n == -2:
    129129                self._roman = 2
    130130                self._str = 'II*'
    131                 self._latex = '$II^{*}$'
     131                self._latex = 'II^{*}'
    132132            elif n == -3:
    133133                self._roman = 3
    134134                self._str = 'III*'
    135                 self._latex = '$III^{*}$'
     135                self._latex = 'III^{*}'
    136136            elif n == -4:
    137137                self._roman = 4
    138138                self._str = 'IV*'
    139                 self._latex = '$IV^{*}$'
     139                self._latex = 'IV^{*}'
    140140            elif n < -4:
    141141                nu = -n - 4
    142142                self._roman = 1
    143143                self._n = nu
    144144                self._str = 'I' + nu.str() +'*'
    145                 self._latex = '$I_' + nu.str() + '^{*}$'
     145                self._latex = 'I_' + nu.str() + '^{*}'
    146146            self._starred = (n < 0)
    147147            self._pari = n
    148148            return
     
    161161            if starred:
    162162                sign = -1
    163163                self._str = "I" + symbol + "*"
    164                 self._latex = "$I" + symbol + "^*$"
     164                self._latex = "I" + symbol + "^*"
    165165            else:
    166166                sign = 1
    167167                self._str = "I" + symbol
    168                 self._latex = "$" + self._str + "$"
     168                self._latex = "" + self._str + ""
    169169            if symbol == "I":
    170170                self._pari = 2 * sign
    171171            elif symbol == "II":
     
    178178            self._n = "generic"
    179179            if starred:
    180180                self._str = "In*"
    181                 self._latex = "$I_n^*$"
     181                self._latex = "I_n^*"
    182182            else:
    183183                self._str = "In"
    184                 self._str = "$I_n$"
     184                self._str = "I_n"
    185185        elif symbol.isdigit():
    186186            self._roman = 1
    187187            self._n = Integer(symbol)
     
    191191                else:
    192192                    self._pari = -self._n - 4
    193193                self._str = "I" + symbol + "*"
    194                 self._latex = "$I_{%s}^*$"%(symbol)
     194                self._latex = "I_{%s}^*"%(symbol)
    195195            else:
    196196                if self._n == 0:
    197197                    self._pari = 1
    198198                else:
    199199                    self._pari = self._n + 4
    200200                self._str = "I" + symbol
    201                 self._latex = "$I_{%s}$"%(symbol)
     201                self._latex = "I_{%s}"%(symbol)
    202202        else:
    203203            raise ValueError, "input is not a Kodaira symbol"
    204204           
     
    224224            sage: from sage.schemes.elliptic_curves.kodaira_symbol import KodairaSymbol_class
    225225            sage: KS = KodairaSymbol_class(15)
    226226            sage: latex(KS)
    227             $I_{11}$
     227            I_{11}
    228228        """
    229229        return self._latex
    230230