Ticket #7585: 7585_12_fixes.patch

File 7585_12_fixes.patch, 75.3 KB (added by David Roe, 13 years ago)
  • sage/interfaces/singular.py

    # HG changeset patch
    # User David Roe <roed@math.harvard.edu>
    # Date 1260893171 18000
    # Node ID d71561904a5a0394914037fe36885c5b0f0933c1
    # Parent  6554460dad08185f295130ceff7d0145e9f2fbae
    Makes Tate's algorithm actually work for elliptic curves over F_p(t).  Adds doctest and makes miscellaneous fixes so that all doctests pass.  Removal of functions from ell_number_field which are now in ell_global_field.
    
    diff -r 6554460dad08 -r d71561904a5a sage/interfaces/singular.py
    a b  
    669669            except TypeError:
    670670                return False
    671671            return True
     672        elif S is int or S is long:
     673            return True
    672674        raise NotImplementedError
    673675       
    674676
  • sage/rings/finite_field_ext_pari.py

    diff -r 6554460dad08 -r d71561904a5a sage/rings/finite_field_ext_pari.py
    a b  
    536536            sage: FiniteField_ext_pari(4,'a')._coerce_(2/3)
    537537            Traceback (most recent call last):
    538538            ...
    539             TypeError: no canonical coercion of element into self
     539            TypeError: no canonical coercion from Rational Field to Finite Field in a of size 2^2
    540540            sage: FiniteField_ext_pari(8,'a')._coerce_(FiniteField_ext_pari(4,'a').0)
    541541            Traceback (most recent call last):
    542542            ...
    543             TypeError: no canonical coercion of element into self
     543            TypeError: no canonical coercion from Finite Field in a of size 2^2 to Finite Field in a of size 2^3
    544544            sage: FiniteField_ext_pari(16,'a')._coerce_(FiniteField_ext_pari(4,'a').0)
    545545            Traceback (most recent call last):
    546546            ...
    547             TypeError: no canonical coercion of element into self
     547            TypeError: no canonical coercion from Finite Field in a of size 2^2 to Finite Field in a of size 2^4
    548548            sage: k = FiniteField_ext_pari(8,'a')
    549549            sage: k._coerce_(FiniteField(7,'a')(2))
    550550            Traceback (most recent call last):
    551551            ...
    552             TypeError: no canonical coercion of element into self
     552            TypeError: no canonical coercion from Finite Field of size 7 to Finite Field in a of size 2^3
    553553        """
    554554        from sage.rings.integer_ring import ZZ
    555555        from sage.rings.integer_mod_ring import IntegerModRing_generic
     
    561561            if R.characteristic() == self.characteristic():
    562562                if R.degree() == 1:
    563563                    return True
    564                 elif self.degree() % K.degree() == 0:
     564                elif self.degree() % R.degree() == 0:
    565565                    # TODO: This is where we *would* do coercion from one nontrivial finite field to another...
    566566                    return False               
    567567        from sage.rings.residue_field import ResidueField_generic
  • sage/rings/fraction_field.py

    diff -r 6554460dad08 -r d71561904a5a sage/rings/fraction_field.py
    a b  
    537537
    538538    Many of the functions here are included for coherence with number fields.
    539539    """
     540    def __init__(self, R,
     541            element_class=fraction_field_element.FractionFieldElement_1poly_field):
     542        """
     543        Just changes the default for element_class
     544
     545        EXAMPLES::
     546
     547            sage: R.<t> = QQ[]; K = R.fraction_field()
     548            sage: K._element_class
     549            <class 'sage.rings.fraction_field_element.FractionFieldElement_1poly_field'>
     550        """
     551        FractionField_generic.__init__(self, R, element_class)
     552
    540553    def ring_of_integers(self):
    541554        """
    542555        Returns the ring of integers in this fraction field.
     
    586599        """
    587600        from sage.rings.ideal import is_Ideal
    588601        if not (is_Ideal(P) and P.ring() is self.ring_of_integers()):
    589             P = self.ideal(P)
     602            P = self.ring_of_integers().ideal(P)
    590603        if not P.is_maximal():
    591604            raise ValueError, "P must be a nonzero prime"
    592605        # Fraction fields of univariate polynomial rings are PIDs.  So we can just take a generator.
     
    618631                raise ValueError, "%s is not a prime ideal"%prime
    619632        from sage.rings.residue_field import ResidueField
    620633        return ResidueField(prime, names = names, check = False)
     634
     635    def class_number(self):
     636        """
     637        Here for compatibility with number fields and function fields.
     638
     639        EXAMPLES::
     640
     641            sage: R.<t> = GF(5)[]; K = R.fraction_field()
     642            sage: K.class_number()
     643            1
     644        """
     645        return 1
  • sage/rings/fraction_field_FpT.pyx

    diff -r 6554460dad08 -r d71561904a5a sage/rings/fraction_field_FpT.pyx
    a b  
    740740            sage: f.valuation(x - 1)
    741741            1
    742742        """
    743         return self.__numerator.valuation(P) - self.__denominator.valuation(P)
     743        return self.numerator().valuation(P) - self.denominator().valuation(P)
     744
     745    def support(self):
     746        """
     747        Returns a sorted list of primes dividing either the numerator or denominator of this element.
     748
     749        EXAMPLES::
     750
     751            sage: R.<t> = GF(11)[]
     752            sage: h = (t^14 + 2*t^12 - 4*t^11 + 3*t^9 - 5*t^8 + t^6 - 4*t^5 + 3*t^3 + t^2 + 2)/(t^6 - 5*t^5 - 2*t^4 - 2*t^2 - t + 4)
     753            sage: h.support()
     754            [t + 3, t + 8, t + 10, t^2 + t + 1, t^2 + 4*t + 8, t^2 + 7*t + 8]
     755        """
     756        L = [fac[0] for fac in self.numerator().factor()] + [fac[0] for fac in self.denominator().factor()]
     757        L.sort()
     758        return L
     759   
     760    def is_integral(self):
     761        """
     762        Returns whether this element is actually a polynomial.
     763
     764        EXAMPLES::
     765
     766            sage: R.<t> = GF(5)[]
     767            sage: K = R.fraction_field
     768        """
     769        # self should be normalized.
     770        return self.denom() == 1
    744771       
    745772cdef class FpT_iter:
    746773    """
  • sage/rings/fraction_field_element.pyx

    diff -r 6554460dad08 -r d71561904a5a sage/rings/fraction_field_element.pyx
    a b  
    979979        """
    980980        if self.__denominator != 1:
    981981            self.reduce()
    982         if self.__denominator == 1:
    983             return int(self.__numerator)
    984         else:
    985             raise TypeError, "denominator must equal 1"
     982        return self.__denominator == 1
    986983
     984    def support(self):
     985        """
     986        Returns a sorted list of primes dividing either the numerator or denominator of this element.
     987
     988        EXAMPLES::
     989
     990            sage: R.<t> = QQ[]
     991            sage: h = (t^14 + 2*t^12 - 4*t^11 - 8*t^9 + 6*t^8 + 12*t^6 - 4*t^5 - 8*t^3 + t^2 + 2)/(t^6 + 6*t^5 + 9*t^4 - 2*t^2 - 12*t - 18)
     992            sage: h.support()
     993            [t - 1, t + 3, t^2 + 2, t^2 + t + 1, t^4 - 2]
     994        """
     995        L = [fac[0] for fac in self.numerator().factor()] + [fac[0] for fac in self.denominator().factor()]
     996        L.sort()
     997        return L
  • sage/rings/polynomial/ideal.py

    diff -r 6554460dad08 -r d71561904a5a sage/rings/polynomial/ideal.py
    a b  
     1"""
     2Ideals in Univariate Polynomial Rings.
    13
     4AUTHORS:
     5 
     6- David Roe (2009-12-14) -- initial version.
     7"""
    28
     9#*****************************************************************************
     10#
     11#   Sage: System for Algebra and Geometry Experimentation   
     12#
     13#       Copyright (C) 2009 DavidRoe <roed@math.harvard.edu>
     14#                          William Stein <wstein@gmail.com>
     15#
     16#  Distributed under the terms of the GNU General Public License (GPL)
     17#
     18#    This code is distributed in the hope that it will be useful,
     19#    but WITHOUT ANY WARRANTY; without even the implied warranty of
     20#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     21#    General Public License for more details.
     22#
     23#  The full text of the GPL is available at:
     24#
     25#                  http://www.gnu.org/licenses/
     26#*****************************************************************************
     27
     28from sage.structure.factorization import Factorization
    329from sage.rings.ideal import Ideal_pid
    430
    531class Ideal_1poly_field(Ideal_pid):
     
    4066        from sage.rings.residue_field import ResidueField
    4167        return ResidueField(self, names, check=False)
    4268   
     69    def factor(self):
     70        """
     71        Returns a factorization of this ideal into prime ideals.
     72
     73        EXAMPLES::
     74       
     75            sage: R.<t> = GF(5)[]
     76            sage: I = R.ideal(t^4 - 1)
     77            sage: F = I.factor(); F
     78            (Principal ideal (t + 1) of Univariate Polynomial Ring in t over Finite Field of size 5) * (Principal ideal (t + 2) of Univariate Polynomial Ring in t over Finite Field of size 5) * (Principal ideal (t + 3) of Univariate Polynomial Ring in t over Finite Field of size 5) * (Principal ideal (t + 4) of Univariate Polynomial Ring in t over Finite Field of size 5)
     79            sage: F.prod() == I
     80            True
     81        """
     82        R = self.ring()
     83        return Factorization([(R.ideal(p), e) for p, e in self.gen().factor()])
     84
     85    def valuation(self, p):
     86        """
     87        Returns the number of times p divides this ideal.
     88
     89        EXAMPLES::
     90
     91            sage: R.<t> = GF(5)[]
     92            sage: I = R.ideal((t+1)^3*t)
     93            sage: I.valuation(t+1)
     94            3
     95            sage: I.valuation(t)
     96            1
     97            sage: I.valuation(t-1)
     98            0
     99        """
     100        return self.gen().valuation(p)
  • sage/rings/polynomial/polynomial_element.pyx

    diff -r 6554460dad08 -r d71561904a5a sage/rings/polynomial/polynomial_element.pyx
    a b  
    46604660                    return ZZ(k)
    46614661        if isinstance(p, Polynomial):
    46624662            p = self.parent().coerce(p)
    4663         elif is_Ideal(p) and p.ring() is self.parent():
     4663        elif is_Ideal(p) and p.ring() is self.parent(): # eventually need to handle fractional ideals in the fraction field
    46644664            if self.parent().base_ring().is_field(): # common case
    46654665                p = p.gen()
    46664666            else:
    46674667                raise NotImplementedError
    46684668        else:
    4669             raise TypeError, "The polynomial, p, must have the same parent as self."
     4669            from sage.rings.fraction_field import is_FractionField
     4670            if is_FractionField(p.parent()) and self.parent().has_coerce_map_from(p.parent().ring()):
     4671                p = self.parent().coerce(p.parent().ring()(p)) # here we require that p be integral.
     4672            else:
     4673                raise TypeError, "The polynomial, p, must have the same parent as self."
    46704674
    46714675        if p.degree() == 0:
    46724676            raise ArithmeticError, "The polynomial, p, must have positive degree."
  • sage/schemes/elliptic_curves/constructor.py

    diff -r 6554460dad08 -r d71561904a5a sage/schemes/elliptic_curves/constructor.py
    a b  
    163163        Algebraic Field
    164164
    165165    """
    166     import ell_generic, ell_field, ell_finite_field, ell_number_field, ell_rational_field, ell_padic_field  # here to avoid circular includes
     166    import ell_generic, ell_field, ell_finite_field, ell_number_field, ell_rational_field, ell_padic_field, ell_global_field  # here to avoid circular includes
    167167   
    168168    if j is not None:
    169169        return EllipticCurve_from_j(j)
     
    224224            return ell_padic_field.EllipticCurve_padic_field(x, y)
    225225        elif rings.is_NumberField(x):
    226226            return ell_number_field.EllipticCurve_number_field(x, y)
     227        elif rings.is_FractionField(x):
     228            # later we'll include more function fields here.
     229            if rings.is_PolynomialRing(x.ring()) and x.base_ring().is_finite() and x.base_ring().is_prime_field():
     230                return ell_global_field.EllipticCurve_global_field(x, y)
     231            else:
     232                return ell_field.EllipticCurve_field(x, y)
    227233        elif rings.is_Field(x):
    228234            return ell_field.EllipticCurve_field(x, y)
    229235        return ell_generic.EllipticCurve_generic(x, y)
     
    275281    elif rings.is_FiniteField(R) or (rings.is_IntegerModRing(R) and R.characteristic().is_prime()):
    276282        return ell_finite_field.EllipticCurve_finite_field(x, y)
    277283
     284    elif rings.is_FractionField(R):
     285        # later we'll include more function fields here.
     286        if rings.is_PolynomialRing(R.ring()) and R.base_ring().is_finite() and R.base_ring().is_prime_field():
     287            return ell_global_field.EllipticCurve_global_field(x, y)
     288        else:
     289            return ell_field.EllipticCurve_field(x, y)
     290
    278291    return ell_generic.EllipticCurve_generic(x, y)
    279292
    280293
  • sage/schemes/elliptic_curves/ell_global_field.py

    diff -r 6554460dad08 -r d71561904a5a sage/schemes/elliptic_curves/ell_global_field.py
    a b  
    11
    22from ell_field import EllipticCurve_field
    33from constructor import EllipticCurve
    4 
     4from sage.misc.misc import verbose, forall, prod
    55
    66class EllipticCurve_global_field(EllipticCurve_field):
    77    """
     
    1717        sage: EllipticCurve([i, i - 1, i + 1, 24*i + 15, 14*i + 35])
    1818        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
    1919
    20         Over function fields::
     20    Over function fields::
    2121
    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)])
     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        Elliptic Curve defined by y^2 = x^3 + (3*t^6+3*t^5+3*t^3+3*t^2)*x + (4*t^9+t^8+3*t^7+2*t^6+3*t^5+t^4+4*t^3) over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
    2425    """
    2526    def is_local_integral_model(self,*P):
    2627        r"""
     
    4243            sage: Emin.is_local_integral_model(P1,P2)
    4344            True
    4445                       
    45                 Over function fields::
     46        Over function fields::
    4647                       
    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)
     48            sage: K.<t> = Frac(GF(5)['t'])
     49            sage: P1 = t+1
     50            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)/t^5])
     51            sage: E.is_local_integral_model(P1)
     52            True
     53            sage: E.is_local_integral_model(t)
     54            False
     55            sage: Et = E.local_integral_model(t)
     56            sage: Et.is_local_integral_model(t)
     57            True
    5358        """
    5459        if len(P)==1: P=P[0]
    5560        if isinstance(P,(tuple,list)):
     
    7883            sage: E.local_integral_model((P1,P2))
    7984            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
    8085
    81                 Over function fields::
     86        Over function fields::
    8287
    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)
     88            sage: K.<t> = Frac(GF(5)['t'])
     89            sage: P1 = t+1
     90            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)])
     91            sage: E.local_integral_model(P1)
     92            Elliptic Curve defined by y^2 = x^3 + (3*t^6+3*t^5+3*t^3+3*t^2)*x + (4*t^15+4*t^13+3*t^10+3*t^8+4*t^5+4*t^3) over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
    8793        """
    8894        if len(P)==1: P=P[0]
    8995        if isinstance(P,(tuple,list)):
     
    108114            sage: Emin.is_global_integral_model()
    109115            True
    110116                       
    111                 Over function fields::
     117        Over function fields::
    112118               
    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()
     119            sage: K.<t> = Frac(GF(5)['t'])
     120            sage: P1 = t+1
     121            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)])
     122            sage: Emin = E.global_integral_model()
     123            sage: Emin.is_global_integral_model()
     124            True
    118125        """
    119126        return forall(self.a_invariants(), lambda x : x.is_integral())[0]
    120127
     
    130137            sage: E.global_integral_model()
    131138            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
    132139
    133                 Over function fields::
     140        Over function fields::
    134141               
    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()
     142            sage: K.<t> = Frac(GF(5)['t'])
     143            sage: P1 = t+1
     144            sage: E = EllipticCurve(K,[0,0,0,(1+t)^-2*t^4,(1+t)^3*t^-2])
     145            sage: E.global_integral_model()
     146            Elliptic Curve defined by y^2 = x^3 + (t^10+2*t^9+t^8)*x + (t^13+4*t^12+t^11+4*t^10+t^9+t^8+4*t^7+t^6+4*t^5+t^4) over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
    139147        """
    140148        K = self.base_field()
     149        R = K.ring_of_integers()
    141150        ai = self.a_invariants()
    142151        for a in ai:
    143152            if not a.is_integral():
    144                for P, _ in K.ideal(a.denominator()).factor():
     153               for P, _ in R.ideal(a.denominator()).factor():
    145154                   pi=K.uniformizer(P,'negative')
    146155                   e  = min([(ai[i].valuation(P)/[1,2,3,4,6][i]) for i in range(5)]).floor()
    147156                   ai = [ai[i]/pi**(e*[1,2,3,4,6][i]) for i in range(5)]
     
    221230            Kodaira Symbol: I0
    222231            Tamagawa Number: 1
    223232                       
    224                 Over function fields::
     233        Over function fields::
    225234               
    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()
     235            sage: K.<t> = Frac(GF(5)['t'])
     236            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)])
     237            sage: E.local_data()
     238            [Local data at Principal ideal (t) of Univariate Polynomial Ring in t over Finite Field of size 5:
     239             Reduction type: bad additive
     240             Local minimal model: Elliptic Curve defined by y^2 = x^3 + (3*t^6+3*t^5+3*t^3+3*t^2)*x + (4*t^9+t^8+3*t^7+2*t^6+3*t^5+t^4+4*t^3) over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
     241             Minimal discriminant valuation: 8
     242             Conductor exponent: 2
     243             Kodaira Symbol: I2*
     244             Tamagawa Number: 4,
     245             Local data at Principal ideal (t + 1) of Univariate Polynomial Ring in t over Finite Field of size 5:
     246             Reduction type: bad additive
     247             Local minimal model: Elliptic Curve defined by y^2 = x^3 + (3*t^6+3*t^5+3*t^3+3*t^2)*x + (4*t^9+t^8+3*t^7+2*t^6+3*t^5+t^4+4*t^3) over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
     248             Minimal discriminant valuation: 6
     249             Conductor exponent: 2
     250             Kodaira Symbol: I0*
     251             Tamagawa Number: 4,
     252             Local data at Principal ideal (t + 4) of Univariate Polynomial Ring in t over Finite Field of size 5:
     253             Reduction type: bad non-split multiplicative
     254             Local minimal model: Elliptic Curve defined by y^2 = x^3 + (3*t^6+3*t^5+3*t^3+3*t^2)*x + (4*t^9+t^8+3*t^7+2*t^6+3*t^5+t^4+4*t^3) over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
     255             Minimal discriminant valuation: 2
     256             Conductor exponent: 1
     257             Kodaira Symbol: I2
     258             Tamagawa Number: 2]
    229259        """
    230260        if proof is None:
    231261            import sage.structure.proof.proof
     
    277307            sage: E._get_local_data(p, False) is E._get_local_data(p, True)
    278308            False
    279309                       
    280                 Over function fields::
     310        Over function fields::
    281311               
    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)
     312            sage: K.<t> = Frac(GF(5)['t'])
     313            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)])
     314            sage: Emin = E._get_local_data(t+1, False)
     315            sage: Emin
     316            Local data at Principal ideal (t + 1) of Univariate Polynomial Ring in t over Finite Field of size 5:
     317            Reduction type: bad additive
     318            Local minimal model: Elliptic Curve defined by y^2 = x^3 + (3*t^6+3*t^5+3*t^3+3*t^2)*x + (4*t^9+t^8+3*t^7+2*t^6+3*t^5+t^4+4*t^3) over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
     319            Minimal discriminant valuation: 6
     320            Conductor exponent: 2
     321            Kodaira Symbol: I0*
     322            Tamagawa Number: 4
    287323        """
    288324        try:
    289325            return self._local_data[P, proof]
     
    330366            sage: E.local_minimal_model(P).ainvs()
    331367            (0, 1, 0, a - 33, -2*a + 64)
    332368                       
    333                 Over function fields::
     369        Over function fields::
    334370               
    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()
     371            sage: K.<t> = Frac(GF(5)['t'])
     372            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)])
     373            sage: E.local_minimal_model(t+1).ainvs()
     374            (0,
     375             0,
     376             0,
     377             3*t^6 + 3*t^5 + 3*t^3 + 3*t^2,
     378             4*t^15 + 4*t^13 + 3*t^10 + 3*t^8 + 4*t^5 + 4*t^3)
    339379        """
    340380        if proof is None:
    341381            import sage.structure.proof.proof
     
    376416            [(Fractional ideal (4*a^2 - 2*a + 1), True),
    377417            (Fractional ideal (2*a + 1), False)]
    378418               
    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]]
     419        Over function fields::
     420           
     421            sage: K.<t> = Frac(GF(5)['t'])
     422            sage: p, q, r = t, t+1, t+2
     423            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)])
     424            sage: [(P, E.has_good_reduction(P)) for P in [p,q,r]]
     425            [(t, False), (t + 1, False), (t + 2, True)]
    385426        """   
    386427        return self.local_data(P).has_good_reduction()
    387428       
     
    417458            [(Fractional ideal (4*a^2 - 2*a + 1), False),
    418459            (Fractional ideal (2*a + 1), True)]
    419460                       
    420                 Over function fields::
     461        Over function fields::
    421462               
    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]]
     463            sage: K.<t> = Frac(GF(5)['t'])
     464            sage: p, q, r = t, t+1, t+2
     465            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)])
     466            sage: [(P, E.has_bad_reduction(P)) for P in [p,q,r]]
     467            [(t, True), (t + 1, True), (t + 2, False)]
    426468        """
    427469        return self.local_data(P).has_bad_reduction()
    428470       
     
    457499            sage: [(p,E.has_multiplicative_reduction(p)) for p in [P17a,P17b]]           
    458500            [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)]
    459501                       
    460                 Over function fields::
     502        Over function fields::
    461503               
    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]]
     504            sage: K.<t> = Frac(GF(5)['t'])
     505            sage: p, q, r = t, t+1, t+2
     506            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)])
     507            sage: [(P, E.has_multiplicative_reduction(P)) for P in [p,q,r]]
     508            [(t, False), (t + 1, False), (t + 2, False)]
    466509        """
    467510        return self.local_data(P).has_multiplicative_reduction()
    468511       
     
    492535            sage: [(p,E.has_split_multiplicative_reduction(p)) for p in [P17a,P17b]]           
    493536            [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)]
    494537                       
    495                 Over function fields::
     538        Over function fields::
    496539               
    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]]
     540            sage: K.<t> = Frac(GF(5)['t'])
     541            sage: p, q, r = t, t+1, t+2
     542            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)])
     543            sage: [(P, E.has_split_multiplicative_reduction(P)) for P in [p,q,r]]
     544            [(t, False), (t + 1, False), (t + 2, False)]
    501545        """
    502546        return self.local_data(P).has_split_multiplicative_reduction()
    503547       
     
    527571            sage: [(p,E.has_nonsplit_multiplicative_reduction(p)) for p in [P17a,P17b]]           
    528572            [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)]
    529573                       
    530                 Over function fields::
     574        Over function fields::
    531575               
    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]]
     576            sage: K.<t> = Frac(GF(5)['t'])
     577            sage: p, q, r = t, t+1, t+2
     578            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)])
     579            sage: [(P, E.has_nonsplit_multiplicative_reduction(P)) for P in [p,q,r]]
     580            [(t, False), (t + 1, False), (t + 2, False)]
    536581        """
    537582        return self.local_data(P).has_nonsplit_multiplicative_reduction()
    538583       
     
    562607            [(Fractional ideal (4*a^2 - 2*a + 1), False),
    563608            (Fractional ideal (2*a + 1), True)]
    564609                       
    565                 Over function fields::
     610        Over function fields::
    566611               
    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]]
     612            sage: K.<t> = Frac(GF(5)['t'])
     613            sage: p, q, r = t, t+1, t+2
     614            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)])
     615            sage: [(P, E.has_additive_reduction(P)) for P in [p,q,r]]
     616            [(t, True), (t + 1, True), (t + 2, False)]
    571617        """
    572618        return self.local_data(P).has_additive_reduction()
    573619       
     
    599645            sage: [E.tamagawa_number(P) for P in K(11).support()]
    600646            [10]
    601647                                       
    602                 Over function fields::
     648        Over function fields::
    603649               
    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()]
     650            sage: K.<t> = Frac(GF(5)['t'])
     651            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)])
     652            sage: [E.tamagawa_number(P) for P in E.discriminant().support()]
     653            [4, 4, 2]
    607654        """
    608655        if proof is None:
    609656            import sage.structure.proof.proof
     
    640687            sage: [E.tamagawa_exponent(P) for P in K(11).support()]
    641688            [10]
    642689                       
    643                 Over function fields::
     690        Over function fields::
    644691               
    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()]
     692            sage: K.<t> = Frac(GF(5)['t'])
     693            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)])
     694            sage: [E.tamagawa_exponent(P) for P in E.discriminant().support()]
     695            [2, 2, 2]
    648696        """
    649697        if proof is None:
    650698            import sage.structure.proof.proof
     
    686734            sage: [E.kodaira_symbol(P) for P in K(11).support()]
    687735            [I10]
    688736                       
    689                 Over function fields::
     737        Over function fields::
    690738               
    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]                 
     739            sage: K.<t> = Frac(GF(5)['t'])
     740            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)])
     741            sage: bad_primes = E.discriminant().support(); bad_primes
     742            [t, t + 1, t + 4]
     743            sage: [E.kodaira_symbol(P) for P in bad_primes]
     744            [I2*, I0*, I2]
    695745        """
    696746        if proof is None:
    697747            import sage.structure.proof.proof
     
    733783            sage: E.conductor()
    734784            Fractional ideal (86304, w + 5898)
    735785
    736                 Over function fields::
     786        Over function fields::
    737787               
    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()
     788            sage: K.<t> = Frac(GF(5)['t'])
     789            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)])
     790            sage: E.conductor()
     791            Principal ideal (t^5 + t^4 + 4*t^3 + 4*t^2) of Univariate Polynomial Ring in t over Finite Field of size 5
     792            sage: E.conductor().gen().factor()
     793            (t + 4) * t^2 * (t + 1)^2
    741794        """
    742795        try:
    743796            return self._conductor
     
    780833            sage: E.global_minimal_model()
    781834            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
    782835
    783                 Over function fields::
     836        Over function fields::
    784837               
    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()
     838            sage: K.<t> = Frac(GF(5)['t'])
     839            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)])
     840            sage: E.global_minimal_model()
     841            Elliptic Curve defined by y^2 = x^3 + (3*t^6+3*t^5+3*t^3+3*t^2)*x + (4*t^9+t^8+3*t^7+2*t^6+3*t^5+t^4+4*t^3) over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
    788842        """
    789843        if proof is None:
    790844            import sage.structure.proof.proof
     
    822876           sage: EK.reduction(K.ideal(1+i))     
    823877           Traceback (most recent call last):
    824878           ... 
    825            AttributeError: The curve must have good reduction at the place.
     879           ValueError: The curve must have good reduction at the place.
    826880           sage: EK.reduction(K.ideal(2)) 
    827881           Traceback (most recent call last):
    828882           ... 
    829            AttributeError: The ideal must be prime.
     883           ValueError: The ideal must be prime.
    830884
    831                 Over function fields::
     885       Over function fields::
    832886               
    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)
     887           sage: K.<t> = Frac(GF(5)['t'])
     888           sage: p = t+2
     889           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)])
     890           sage: E.reduction(p)
     891           Elliptic Curve defined by y^2 = x^3 + 4*x over Residue field of Principal ideal (t + 2) of Univariate Polynomial Ring in t over Finite Field of size 5
     892           sage: E.reduction(t)
     893           Traceback (most recent call last):
     894           ... 
     895           ValueError: The curve must have good reduction at the place.
    838896       """
    839897       K = self.base_field()
    840898       OK = K.ring_of_integers()
    841899       try:
    842            place = K.ideal(place)
     900           place = OK.ideal(place)
    843901       except TypeError:
    844902           raise TypeError, "The parameter must be an ideal of the base field of the elliptic curve"
    845903       if not place.is_prime():
    846            raise AttributeError, "The ideal must be prime."
     904           raise ValueError, "The ideal must be prime."
    847905       disc = self.discriminant()
    848        if not K.ideal(disc).valuation(place) == 0:
    849            raise AttributeError, "The curve must have good reduction at the place."
     906       if not OK.ideal(disc).valuation(place) == 0:
     907           raise ValueError, "The curve must have good reduction at the place."
    850908       Fv = OK.residue_field(place)
    851909       return self.change_ring(Fv)
     910
     911    def _tidy_model(self):
     912        """
     913        Returns an isomorphic curve with `a_1`, `a_2` and `a_3` as 0 as possible.
     914
     915        Since ``_tidy_model`` is overridden for number fields, this function only needs to work for function fields.
     916
     917        The current implementation only works for fraction fields of polynomial rings (over finite fields).
     918
     919        In characteristic 2, we make a_2=0.
     920
     921        In characteristic 3, we make a_1=0 and a_3=0.
     922       
     923        Otherwise, we make all three 0.
     924
     925        EXAMPLES::
     926
     927            sage: R.<t> = GF(5)[]; K = R.fraction_field()
     928            sage: E = EllipticCurve(K, [t, t^2-2, t^5+2*t+1, 0, t^6])
     929            sage: E._tidy_model()
     930            Elliptic Curve defined by y^2 = x^3 + (3*t^6+t^2+3*t+2)*x + (4*t^10+4*t^6+3*t^5+3*t+1) over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
     931           
     932            sage: R.<t> = GF(3)[]; K = R.fraction_field()
     933            sage: E = EllipticCurve(K, [t, t^2-2, t^5+2*t+1, 0, t^6])
     934            sage: E._tidy_model()
     935            Elliptic Curve defined by y^2 = x^3 + (2*t^2+1)*x^2 + (2*t^6+t^2+2*t)*x + (t^10+2*t^6+2*t^5+t^2+t+1) over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 3
     936
     937            sage: R.<t> = GF(2)[]; K = R.fraction_field()
     938            sage: E = EllipticCurve(K, [t, t^2+1, t^5+t+1, 0, t^6])
     939            sage: E._tidy_model()
     940            Elliptic Curve defined by y^2 + t*x*y + (t^5+t^3+1)*y = x^3 + (t^4+1)*x + t^6 over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 2 (using NTL)
     941        """
     942        p = self.base_ring().characteristic()
     943        a1, a2, a3, a4, a6 = self.a_invariants()
     944        if p == 2:
     945            s = 0
     946            r = -a2/3
     947            t = 0
     948        elif p == 3:
     949            s = -a1/2
     950            r = 0
     951            t = -a3/2
     952        else:
     953            s = -a1/2
     954            r = (-a2 + s*a1 + s*s)/3
     955            t = (-a3 - r*a1)/2
     956        return self.rst_transform(r, s, t)
  • sage/schemes/elliptic_curves/ell_local_data.py

    diff -r 6554460dad08 -r d71561904a5a sage/schemes/elliptic_curves/ell_local_data.py
    a b  
    2828
    2929from sage.rings.all import PolynomialRing, QQ, ZZ, Integer, is_Ideal, is_NumberFieldElement, is_NumberFieldFractionalIdeal, is_NumberField
    3030from sage.rings.polynomial.polynomial_ring import is_PolynomialRing
     31from sage.rings.fraction_field import is_FractionField
    3132from sage.structure.element import RingElement
    3233from constructor import EllipticCurve
    3334from kodaira_symbol import KodairaSymbol
     
    138139            sage: K.<t> = Frac(GF(5)['t'])
    139140            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)])
    140141            sage: EllipticCurveLocalData(E,t)
     142            Local data at Principal ideal (t) of Univariate Polynomial Ring in t over Finite Field of size 5:
     143            Reduction type: bad additive
     144            Local minimal model: Elliptic Curve defined by y^2 = x^3 + (3*t^6+3*t^5+3*t^3+3*t^2)*x + (4*t^9+t^8+3*t^7+2*t^6+3*t^5+t^4+4*t^3) over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
     145            Minimal discriminant valuation: 8
     146            Conductor exponent: 2
     147            Kodaira Symbol: I2*
     148            Tamagawa Number: 4
    141149        """
    142150        self._curve = E
    143151        K = E.base_field()
     
    192200            sage: K.<t> = Frac(GF(5)['t'])
    193201            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)])
    194202            sage: EllipticCurveLocalData(E,t).__repr__()
     203            'Local data at Principal ideal (t) of Univariate Polynomial Ring in t over Finite Field of size 5:\nReduction type: bad additive\nLocal minimal model: Elliptic Curve defined by y^2 = x^3 + (3*t^6+3*t^5+3*t^3+3*t^2)*x + (4*t^9+t^8+3*t^7+2*t^6+3*t^5+t^4+4*t^3) over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5\nMinimal discriminant valuation: 8\nConductor exponent: 2\nKodaira Symbol: I2*\nTamagawa Number: 4'
    195204        """
    196205        red_type = "good"
    197206        if not self._reduction_type is None:
     
    219228            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)])
    220229            sage: data = EllipticCurveLocalData(E,t)
    221230            sage: data.minimal_model()
     231            Elliptic Curve defined by y^2 = x^3 + (3*t^6+3*t^5+3*t^3+3*t^2)*x + (4*t^9+t^8+3*t^7+2*t^6+3*t^5+t^4+4*t^3) over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 5
    222232            sage: data.minimal_model() == E.local_minimal_model(t)
     233            True
    223234        """
    224235        return self._Emin
    225236
     
    242253            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)])
    243254            sage: data = EllipticCurveLocalData(E,t)
    244255            sage: data.prime()
     256            Principal ideal (t) of Univariate Polynomial Ring in t over Finite Field of size 5
    245257        """
    246258        return self._prime
    247259
     
    264276            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)])
    265277            sage: data = EllipticCurveLocalData(E,t)
    266278            sage: data.conductor_valuation()
     279            2
    267280        """
    268281        return self._fp
    269282
     
    286299            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)])
    287300            sage: data = EllipticCurveLocalData(E,t)
    288301            sage: data.kodaira_symbol()
     302            I2*
    289303        """
    290304        return self._KS
    291305
     
    310324            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)])
    311325            sage: data = EllipticCurveLocalData(E,t)
    312326            sage: data.tamagawa_number()
     327            4
    313328        """
    314329        return self._cp
    315330
     
    347362            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)])
    348363            sage: data = EllipticCurveLocalData(E,t)
    349364            sage: data.kodaira_symbol()
     365            I2*
    350366            sage: data.tamagawa_number()
     367            4
    351368            sage: data.tamagawa_exponent()
     369            2
    352370        """
    353371        cp = self._cp
    354372        if cp!=4:
     
    389407            sage: p, q = t, t+1
    390408            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)])
    391409            sage: [(P, E.local_data(P).bad_reduction_type()) for P in [p,q]]
     410            [(t, 0), (t + 1, 0)]
    392411        """
    393412        return self._reduction_type
    394413   
     
    415434            sage: p, q = t+1, t+2
    416435            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)])
    417436            sage: [(P, E.local_data(P).has_good_reduction()) for P in [p,q]]
     437            [(t + 1, False), (t + 2, True)]
    418438        """
    419439        return self._reduction_type is None
    420440       
     
    443463            sage: p, q = t+1, t+2
    444464            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)])
    445465            sage: [(P, E.local_data(P).has_bad_reduction()) for P in [p,q]]
     466            [(t + 1, True), (t + 2, False)]
    446467        """
    447468        return not self._reduction_type is None
    448469       
     
    471492
    472493        Over function fields::
    473494               
    474             sage: K.<t> = Frac(GF(5)['t'])
     495            sage: K.<t> = Frac(GF(2)['t'])
    475496            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)])
     497            sage: E = EllipticCurve(K,[t,t+1,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)])
    477498            sage: [(P, E.local_data(P).has_multiplicative_reduction()) for P in [p,q]]
     499            [(t, False), (t + 1, True)]
    478500        """
    479501        return self._reduction_type in (-1,+1)
    480502       
     
    499521
    500522        Over function fields::
    501523               
    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]]
     524            sage: K.<t> = Frac(GF(2)['t'])
     525            sage: p, q, r = t+1, t^2+t+1, t^3+t^2+1
     526            sage: E = EllipticCurve(K,[t,t^2+1,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(t^6-3*t^5-3*t^4+2*t^3)])
     527            sage: [(P, E.local_data(P).has_multiplicative_reduction()) for P in [p,q,r]]
     528            [(t + 1, True), (t^2 + t + 1, True), (t^3 + t^2 + 1, True)]
     529            sage: [(P, E.local_data(P).has_split_multiplicative_reduction()) for P in [p,q,r]]
     530            [(t + 1, True), (t^2 + t + 1, False), (t^3 + t^2 + 1, False)]
    506531        """
    507532        return self._reduction_type == +1
    508533       
     
    526551
    527552        Over function fields::
    528553               
    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]]
     554            sage: K.<t> = Frac(GF(2)['t'])
     555            sage: p, q, r = t+1, t^2+t+1, t^3+t^2+1
     556            sage: E = EllipticCurve(K,[t,t^2+1,0,(1+t)^2*(-27*(t^4-t^3+t^2)),(1+t)^3*27*(t^6-3*t^5-3*t^4+2*t^3)])
     557            sage: [(P, E.local_data(P).has_multiplicative_reduction()) for P in [p,q,r]]
     558            [(t + 1, True), (t^2 + t + 1, True), (t^3 + t^2 + 1, True)]
     559            sage: [(P, E.local_data(P).has_nonsplit_multiplicative_reduction()) for P in [p,q,r]]
     560            [(t + 1, False), (t^2 + t + 1, True), (t^3 + t^2 + 1, True)]
    533561        """
    534562        return self._reduction_type == -1
    535563       
     
    554582
    555583        Over function fields::
    556584               
    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]]
     585            sage: K.<t> = Frac(GF(3)['t'])
     586            sage: p, q, r, s = t, t^3 + 2*t^2 + t + 1, t^4 + t^3 + t^2 + t + 1, t^8 + 2*t^6 + t^5 + 2*t + 2
     587            sage: E = EllipticCurve(K,[0,t,t^4+1,(1+t)^2*(-25*(t^4-2*t^3+t^2)),(1+t)^3*25*(t^6+t^5+2*t^4+2*t^3)])
     588            sage: [(P, E.local_data(P).has_bad_reduction()) for P in [p,q,r,s]]
     589            [(t, True),
     590             (t^3 + 2*t^2 + t + 1, True),
     591             (t^4 + t^3 + t^2 + t + 1, True),
     592             (t^8 + 2*t^6 + t^5 + 2*t + 2, True)]
     593            sage: [(P, E.local_data(P).has_additive_reduction()) for P in [p,q,r,s]]
     594            [(t, True),
     595             (t^3 + 2*t^2 + t + 1, False),
     596             (t^4 + t^3 + t^2 + t + 1, False),
     597             (t^8 + 2*t^6 + t^5 + 2*t + 2, False)]
    561598        """
    562599        return self._reduction_type == 0
    563600       
     
    597634        t = verbose("Running Tate's algorithm with P = %s"%P, level=1)
    598635        F = OK.residue_field(P)
    599636        p = F.characteristic()
     637        if P is infinity: # for the point at infinity on P^1(k(t))
     638            Eaux = EllipticCurve([a(~K.gen()) for a in E.a_invariants()])
     639            LDaux = EllipticCurveLocalData(Eaux, OK.gen(), proof)
     640            Emin = EllipticCurve([a(~K.gen()) for a in LDaux._Emin.a_invariants()])
     641            return Emin, p, LDaux._val_disc, LDaux._fp, LDaux._KS, LDaux._cp, LDaux._split
    600642
    601643        # In case P is not principal we mostly use a uniformiser which
    602644        # is globally integral (with positive valuation at some other
     
    9731015        sage: [check_prime(K,P) for P in K.primes_above(31)]
    9741016        [Fractional ideal (-5/2*a - 1/2), Fractional ideal (-5/2*a + 1/2)]
    9751017
    976         Over function fields::
     1018    Over function fields::
    9771019               
    978                 sage: K.<t> = Frac(GF(5)['t'])
    979                 sage: R = K.ring_of_integers()
    980                 sage: check_prime(K,R.ideal(t))
     1020        sage: K.<t> = Frac(GF(5)['t'])
     1021        sage: R = K.ring_of_integers()
     1022        sage: check_prime(K,R.ideal(t))
     1023        Principal ideal (t) of Univariate Polynomial Ring in t over Finite Field of size 5
    9811024    """
    9821025    if K is QQ:
    9831026        if isinstance(P, (int,long,Integer)):
     
    9911034                return P.gen()
    9921035        raise TypeError, "%s is not a prime ideal of %s"%(P,ZZ)
    9931036
     1037    if is_FractionField(K) and is_PolynomialRing(K.ring()) and K.base_ring().is_finite():
     1038        if P is infinity: # eventually this will be replaced with an actual place class, but for now...
     1039            return P
     1040        if not (is_Ideal(P) and P.ring() is K.ring()):
     1041            P = K.ring().ideal(P)
     1042        if not P.is_prime():
     1043            raise TypeError, "%s is not a prime ideal of %s"%(P, K.ring())
     1044        return P
     1045
    9941046    if not is_NumberField(K):
    9951047        raise TypeError, "%s is not a number field"%K
    9961048       
  • sage/schemes/elliptic_curves/ell_number_field.py

    diff -r 6554460dad08 -r d71561904a5a sage/schemes/elliptic_curves/ell_number_field.py
    a b  
    200200        prob_gens = [self(P) for P in t[2]]
    201201        return prob_rank, two_selmer_rank, prob_gens
    202202               
    203     def is_local_integral_model(self,*P):
    204         r"""
    205         Tests if self is integral at the prime ideal `P`, or at all the
    206         primes if `P` is a list or tuple.
    207        
    208         INPUT:
    209 
    210         - ``*P`` -- a prime ideal, or a list or tuple of primes.
    211        
    212         EXAMPLES::
    213 
    214             sage: K.<i> = NumberField(x^2+1)
    215             sage: P1,P2 = K.primes_above(5)
    216             sage: E = EllipticCurve([i/5,i/5,i/5,i/5,i/5])
    217             sage: E.is_local_integral_model(P1,P2)
    218             False
    219             sage: Emin = E.local_integral_model(P1,P2)
    220             sage: Emin.is_local_integral_model(P1,P2)
    221             True
    222         """
    223         if len(P)==1: P=P[0]
    224         if isinstance(P,(tuple,list)):
    225             return forall(P, lambda x : self.is_local_integral_model(x))[0]
    226         return forall(self.ainvs(), lambda x : x.valuation(P) >= 0)[0]
    227 
    228     def local_integral_model(self,*P):
    229         r"""
    230         Return a model of self which is integral at the prime ideal
    231         `P`.
    232 
    233         .. note::
    234 
    235            The integrality at other primes is not affected, even if
    236            `P` is non-principal.
    237        
    238         INPUT:
    239 
    240         - ``*P`` -- a prime ideal, or a list or tuple of primes.
    241        
    242         EXAMPLES::
    243 
    244             sage: K.<i> = NumberField(x^2+1)
    245             sage: P1,P2 = K.primes_above(5)
    246             sage: E = EllipticCurve([i/5,i/5,i/5,i/5,i/5])
    247             sage: E.local_integral_model((P1,P2))
    248             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
    249         """
    250         if len(P)==1: P=P[0]
    251         if isinstance(P,(tuple,list)):
    252             E=self
    253             for Pi in P: E=E.local_integral_model(Pi)
    254             return E
    255         ai = self.a_invariants()
    256         e  = min([(ai[i].valuation(P)/[1,2,3,4,6][i]) for i in range(5)]).floor()
    257         pi = self.base_field().uniformizer(P, 'negative')
    258         return EllipticCurve([ai[i]/pi**(e*[1,2,3,4,6][i]) for i in range(5)])
    259 
    260     def is_global_integral_model(self):
    261         r"""
    262         Return true iff self is integral at all primes.
    263        
    264         EXAMPLES::
    265 
    266             sage: K.<i> = NumberField(x^2+1)
    267             sage: E = EllipticCurve([i/5,i/5,i/5,i/5,i/5])
    268             sage: P1,P2 = K.primes_above(5)
    269             sage: Emin = E.global_integral_model()
    270             sage: Emin.is_global_integral_model()
    271             True
    272         """
    273         return forall(self.a_invariants(), lambda x : x.is_integral())[0]
    274 
    275     def global_integral_model(self):
    276         r"""
    277         Return a model of self which is integral at all primes.
    278        
    279         EXAMPLES::
    280 
    281             sage: K.<i> = NumberField(x^2+1)
    282             sage: E = EllipticCurve([i/5,i/5,i/5,i/5,i/5])
    283             sage: P1,P2 = K.primes_above(5)
    284             sage: E.global_integral_model()
    285             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
    286 
    287         """
    288         K = self.base_field()
    289         ai = self.a_invariants()
    290         for a in ai:
    291             if not a.is_integral():
    292                for P, _ in K.ideal(a.denominator()).factor():
    293                    pi=K.uniformizer(P,'negative')
    294                    e  = min([(ai[i].valuation(P)/[1,2,3,4,6][i]) for i in range(5)]).floor()
    295                    ai = [ai[i]/pi**(e*[1,2,3,4,6][i]) for i in range(5)]
    296         for z in ai:
    297             assert z.denominator() == 1, "bug in global_integral_model: %s" % ai
    298         return EllipticCurve(list(ai))
    299 
    300     integral_model = global_integral_model
    301 
    302203    def _tidy_model(self):
    303204        r"""
    304205
     
    357258        raise DeprecationWarning, "local_information is deprecated; use local_data instead"
    358259        return self.local_data(P,proof)
    359260
    360     def local_data(self, P=None, proof = None):
    361         r"""
    362         Local data for this elliptic curve at the prime `P`.
    363 
    364         INPUT:
    365 
    366         - ``P`` -- either None or a prime ideal of the base field of self.
    367 
    368         - ``proof`` -- whether to only use provably correct methods
    369           (default controlled by global proof module).  Note that the
    370           proof module is number_field, not elliptic_curves, since the
    371           functions that actually need the flag are in number fields.
    372                      
    373         OUTPUT:
    374 
    375         If `P` is specified, returns the ``EllipticCurveLocalData``
    376         object associated to the prime `P` for this curve.  Otherwise,
    377         returns a list of such objects, one for each prime `P` in the
    378         support of the discriminant of this model.
    379 
    380         .. note::
    381 
    382            The model is not required to be integral on input.
    383 
    384            For principal `P`, a generator is used as a uniformizer,
    385            and integrality or minimality at other primes is not
    386            affected.  For non-principal `P`, the minimal model
    387            returned will preserve integrality at other primes, but not
    388            minimality.
    389 
    390         EXAMPLES::
    391 
    392             sage: K.<i> = NumberField(x^2+1)
    393             sage: E = EllipticCurve([1 + i, 0, 1, 0, 0])
    394             sage: E.local_data()
    395             [Local data at Fractional ideal (2*i + 1):
    396             Reduction type: bad non-split multiplicative
    397             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
    398             Minimal discriminant valuation: 1
    399             Conductor exponent: 1
    400             Kodaira Symbol: I1
    401             Tamagawa Number: 1,
    402             Local data at Fractional ideal (-3*i - 2):
    403             Reduction type: bad split multiplicative
    404             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
    405             Minimal discriminant valuation: 2
    406             Conductor exponent: 1
    407             Kodaira Symbol: I2
    408             Tamagawa Number: 2]
    409             sage: E.local_data(K.ideal(3))
    410             Local data at Fractional ideal (3):
    411             Reduction type: good
    412             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
    413             Minimal discriminant valuation: 0
    414             Conductor exponent: 0
    415             Kodaira Symbol: I0
    416             Tamagawa Number: 1
    417 
    418         An example raised in \#3897::
    419 
    420             sage: E = EllipticCurve([1,1])
    421             sage: E.local_data(3)
    422             Local data at Principal ideal (3) of Integer Ring:
    423             Reduction type: good
    424             Local minimal model: Elliptic Curve defined by y^2 = x^3 + x + 1 over Rational Field
    425             Minimal discriminant valuation: 0
    426             Conductor exponent: 0
    427             Kodaira Symbol: I0
    428             Tamagawa Number: 1
    429         """
    430         if proof is None:
    431             import sage.structure.proof.proof
    432             # We use the "number_field" flag because the actual proof dependence is in Pari's number field functions.
    433             proof = sage.structure.proof.proof.get_flag(None, "number_field")
    434 
    435         if P is None:
    436             primes = self.base_ring()(self.discriminant()).support()
    437             return [self._get_local_data(pr, proof) for pr in primes]
    438 
    439         from sage.schemes.elliptic_curves.ell_local_data import check_prime
    440         P = check_prime(self.base_field(),P)
    441 
    442         return self._get_local_data(P,proof)       
    443 
    444     def _get_local_data(self, P, proof):
    445         r"""
    446         Internal function to create data for this elliptic curve at the prime `P`.
    447        
    448         This function handles the caching of local data.  It is called
    449         by local_data() which is the user interface and which parses
    450         the input parameters `P` and proof.
    451        
    452         INPUT:
    453 
    454         - ``P`` -- either None or a prime ideal of the base field of self.
    455 
    456         - ``proof`` -- whether to only use provably correct methods
    457           (default controlled by global proof module).  Note that the
    458           proof module is number_field, not elliptic_curves, since the
    459           functions that actually need the flag are in number fields.
    460                      
    461         EXAMPLES::
    462 
    463             sage: K.<i> = NumberField(x^2+1)
    464             sage: E = EllipticCurve(K,[0,1,0,-160,308])
    465             sage: p = K.ideal(i+1)
    466             sage: E._get_local_data(p, False)
    467             Local data at Fractional ideal (i + 1):
    468             Reduction type: good
    469             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
    470             Minimal discriminant valuation: 0
    471             Conductor exponent: 0
    472             Kodaira Symbol: I0
    473             Tamagawa Number: 1
    474            
    475         Verify that we cache based on the proof value::
    476 
    477             sage: E._get_local_data(p, False) is E._get_local_data(p, True)
    478             False
    479         """
    480         try:
    481             return self._local_data[P, proof]
    482         except AttributeError:
    483             self._local_data = {}
    484         except KeyError:
    485             pass
    486         from sage.schemes.elliptic_curves.ell_local_data import EllipticCurveLocalData   
    487         self._local_data[P, proof] = EllipticCurveLocalData(self, P, proof)
    488         return self._local_data[P, proof]       
    489 
    490     def local_minimal_model(self, P, proof = None):
    491         r"""
    492         Returns a model which is integral at all primes and minimal at `P`.
    493 
    494         INPUT:
    495 
    496         - ``P`` -- either None or a prime ideal of the base field of self.
    497 
    498         - ``proof`` -- whether to only use provably correct methods
    499           (default controlled by global proof module).  Note that the
    500           proof module is number_field, not elliptic_curves, since the
    501           functions that actually need the flag are in number fields.
    502                      
    503         OUTPUT:
    504 
    505         A model of the curve which is minimal (and integral) at `P`.
    506 
    507         .. note::
    508 
    509            The model is not required to be integral on input.
    510 
    511            For principal `P`, a generator is used as a uniformizer,
    512            and integrality or minimality at other primes is not
    513            affected.  For non-principal `P`, the minimal model
    514            returned will preserve integrality at other primes, but not
    515            minimality.
    516 
    517         EXAMPLES::
    518 
    519             sage: K.<a>=NumberField(x^2-5)
    520             sage: E=EllipticCurve([20, 225, 750, 625*a + 6875, 31250*a + 46875])
    521             sage: P=K.ideal(a)
    522             sage: E.local_minimal_model(P).ainvs()
    523             (0, 1, 0, a - 33, -2*a + 64)
    524         """
    525         if proof is None:
    526             import sage.structure.proof.proof
    527             # We use the "number_field" flag because the actual proof dependence is in Pari's number field functions.
    528             proof = sage.structure.proof.proof.get_flag(None, "number_field")
    529 
    530         return self.local_data(P, proof).minimal_model()
    531 
    532     def has_good_reduction(self, P):
    533         r"""
    534         Return True if this elliptic curve has good reduction at the prime `P`.
    535 
    536         INPUT:
    537 
    538         - ``P`` -- a prime ideal of the base field of self, or a field
    539           element generating such an ideal.
    540            
    541         OUTPUT:
    542        
    543         (bool) -- True if the curve has good reduction at `P`, else False.
    544 
    545         .. note::
    546 
    547            This requires determining a local integral minimal model;
    548            we do not just check that the discriminant of the current
    549            model has valuation zero.
    550 
    551         EXAMPLES::
    552 
    553             sage: E=EllipticCurve('14a1')
    554             sage: [(p,E.has_good_reduction(p)) for p in prime_range(15)]
    555             [(2, False), (3, True), (5, True), (7, False), (11, True), (13, True)]
    556    
    557             sage: K.<a>=NumberField(x^3-2)
    558             sage: P17a, P17b = [P for P,e in K.factor(17)]
    559             sage: E = EllipticCurve([0,0,0,0,2*a+1])
    560             sage: [(p,E.has_good_reduction(p)) for p in [P17a,P17b]]           
    561             [(Fractional ideal (4*a^2 - 2*a + 1), True),
    562             (Fractional ideal (2*a + 1), False)]
    563         """   
    564         return self.local_data(P).has_good_reduction()
    565        
    566     def has_bad_reduction(self, P):
    567         r"""
    568         Return True if this elliptic curve has bad reduction at the prime `P`.
    569 
    570         INPUT:
    571 
    572         - ``P`` -- a prime ideal of the base field of self, or a field
    573           element generating such an ideal.
    574            
    575         OUTPUT:
    576 
    577         (bool) True if the curve has bad reduction at `P`, else False.
    578 
    579         .. note::
    580 
    581            This requires determining a local integral minimal model;
    582            we do not just check that the discriminant of the current
    583            model has valuation zero.
    584 
    585         EXAMPLES::
    586 
    587             sage: E=EllipticCurve('14a1')
    588             sage: [(p,E.has_bad_reduction(p)) for p in prime_range(15)]
    589             [(2, True), (3, False), (5, False), (7, True), (11, False), (13, False)]
    590  
    591             sage: K.<a>=NumberField(x^3-2)
    592             sage: P17a, P17b = [P for P,e in K.factor(17)]
    593             sage: E = EllipticCurve([0,0,0,0,2*a+1])
    594             sage: [(p,E.has_bad_reduction(p)) for p in [P17a,P17b]]           
    595             [(Fractional ideal (4*a^2 - 2*a + 1), False),
    596             (Fractional ideal (2*a + 1), True)]
    597         """
    598         return self.local_data(P).has_bad_reduction()
    599        
    600     def has_multiplicative_reduction(self, P):
    601         r"""
    602         Return True if this elliptic curve has (bad) multiplicative reduction at the prime `P`.
    603 
    604         .. note::
    605 
    606            See also ``has_split_multiplicative_reduction()`` and
    607            ``has_nonsplit_multiplicative_reduction()``.
    608 
    609         INPUT:
    610 
    611         - ``P`` -- a prime ideal of the base field of self, or a field
    612                  element generating such an ideal.
    613            
    614         OUTPUT:
    615 
    616         (bool) True if the curve has multiplicative reduction at `P`,
    617         else False.
    618 
    619         EXAMPLES::
    620 
    621             sage: E=EllipticCurve('14a1')
    622             sage: [(p,E.has_multiplicative_reduction(p)) for p in prime_range(15)]
    623             [(2, True), (3, False), (5, False), (7, True), (11, False), (13, False)]
    624  
    625             sage: K.<a>=NumberField(x^3-2)
    626             sage: P17a, P17b = [P for P,e in K.factor(17)]
    627             sage: E = EllipticCurve([0,0,0,0,2*a+1])
    628             sage: [(p,E.has_multiplicative_reduction(p)) for p in [P17a,P17b]]           
    629             [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)]
    630         """
    631         return self.local_data(P).has_multiplicative_reduction()
    632        
    633     def has_split_multiplicative_reduction(self, P):
    634         r"""
    635         Return True if this elliptic curve has (bad) split multiplicative reduction at the prime `P`.
    636 
    637         INPUT:
    638 
    639         - ``P`` -- a prime ideal of the base field of self, or a field
    640           element generating such an ideal.
    641            
    642         OUTPUT:
    643 
    644         (bool) True if the curve has split multiplicative reduction at
    645         `P`, else False.
    646 
    647         EXAMPLES::
    648 
    649             sage: E=EllipticCurve('14a1')
    650             sage: [(p,E.has_split_multiplicative_reduction(p)) for p in prime_range(15)]
    651             [(2, False), (3, False), (5, False), (7, True), (11, False), (13, False)]
    652  
    653             sage: K.<a>=NumberField(x^3-2)
    654             sage: P17a, P17b = [P for P,e in K.factor(17)]
    655             sage: E = EllipticCurve([0,0,0,0,2*a+1])
    656             sage: [(p,E.has_split_multiplicative_reduction(p)) for p in [P17a,P17b]]           
    657             [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)]
    658         """
    659         return self.local_data(P).has_split_multiplicative_reduction()
    660        
    661     def has_nonsplit_multiplicative_reduction(self, P):
    662         r"""
    663         Return True if this elliptic curve has (bad) non-split multiplicative reduction at the prime `P`.
    664 
    665         INPUT:
    666 
    667         - ``P`` -- a prime ideal of the base field of self, or a field
    668           element generating such an ideal.
    669            
    670         OUTPUT:
    671 
    672         (bool) True if the curve has non-split multiplicative
    673         reduction at `P`, else False.
    674 
    675         EXAMPLES::
    676 
    677             sage: E=EllipticCurve('14a1')
    678             sage: [(p,E.has_nonsplit_multiplicative_reduction(p)) for p in prime_range(15)]
    679             [(2, True), (3, False), (5, False), (7, False), (11, False), (13, False)]
    680  
    681             sage: K.<a>=NumberField(x^3-2)
    682             sage: P17a, P17b = [P for P,e in K.factor(17)]
    683             sage: E = EllipticCurve([0,0,0,0,2*a+1])
    684             sage: [(p,E.has_nonsplit_multiplicative_reduction(p)) for p in [P17a,P17b]]           
    685             [(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)]
    686         """
    687         return self.local_data(P).has_nonsplit_multiplicative_reduction()
    688        
    689     def has_additive_reduction(self, P):
    690         r"""
    691         Return True if this elliptic curve has (bad) additive reduction at the prime `P`.
    692 
    693         INPUT:
    694        
    695         - ``P`` -- a prime ideal of the base field of self, or a field
    696           element generating such an ideal.
    697            
    698         OUTPUT:
    699 
    700         (bool) True if the curve has additive reduction at `P`, else False.
    701 
    702         EXAMPLES::
    703 
    704             sage: E=EllipticCurve('27a1')
    705             sage: [(p,E.has_additive_reduction(p)) for p in prime_range(15)]
    706             [(2, False), (3, True), (5, False), (7, False), (11, False), (13, False)]
    707  
    708             sage: K.<a>=NumberField(x^3-2)
    709             sage: P17a, P17b = [P for P,e in K.factor(17)]
    710             sage: E = EllipticCurve([0,0,0,0,2*a+1])
    711             sage: [(p,E.has_additive_reduction(p)) for p in [P17a,P17b]]           
    712             [(Fractional ideal (4*a^2 - 2*a + 1), False),
    713             (Fractional ideal (2*a + 1), True)]
    714         """
    715         return self.local_data(P).has_additive_reduction()
    716        
    717     def tamagawa_number(self, P, proof = None):
    718         r"""
    719         Returns the Tamagawa number of this elliptic curve at the prime `P`.
    720 
    721         INPUT:
    722 
    723         - ``P`` -- either None or a prime ideal of the base field of self.
    724 
    725         - ``proof`` -- whether to only use provably correct methods
    726           (default controlled by global proof module).  Note that the
    727           proof module is number_field, not elliptic_curves, since the
    728           functions that actually need the flag are in number fields.
    729                      
    730         OUTPUT:
    731 
    732         (positive integer) The Tamagawa number of the curve at `P`.
    733 
    734         EXAMPLES::
    735 
    736             sage: K.<a>=NumberField(x^2-5)
    737             sage: E=EllipticCurve([20, 225, 750, 625*a + 6875, 31250*a + 46875])
    738             sage: [E.tamagawa_number(P) for P in E.discriminant().support()]
    739             [1, 1, 1, 1]
    740             sage: K.<a> = QuadraticField(-11)
    741             sage: E = EllipticCurve('11a1').change_ring(K)
    742             sage: [E.tamagawa_number(P) for P in K(11).support()]
    743             [10]
    744         """
    745         if proof is None:
    746             import sage.structure.proof.proof
    747             # We use the "number_field" flag because the actual proof dependence is in Pari's number field functions.
    748             proof = sage.structure.proof.proof.get_flag(None, "number_field")
    749 
    750         return self.local_data(P, proof).tamagawa_number()
    751 
    752     def tamagawa_exponent(self, P, proof = None):
    753         r"""
    754         Returns the Tamagawa index of this elliptic curve at the prime `P`.
    755 
    756         INPUT:
    757 
    758         - ``P`` -- either None or a prime ideal of the base field of self.
    759 
    760         - ``proof`` -- whether to only use provably correct methods
    761           (default controlled by global proof module).  Note that the
    762           proof module is number_field, not elliptic_curves, since the
    763           functions that actually need the flag are in number fields.
    764                      
    765         OUTPUT:
    766 
    767         (positive integer) The Tamagawa index of the curve at P.
    768 
    769         EXAMPLES::
    770 
    771             sage: K.<a>=NumberField(x^2-5)
    772             sage: E=EllipticCurve([20, 225, 750, 625*a + 6875, 31250*a + 46875])
    773             sage: [E.tamagawa_exponent(P) for P in E.discriminant().support()]
    774             [1, 1, 1, 1]
    775             sage: K.<a> = QuadraticField(-11)
    776             sage: E = EllipticCurve('11a1').change_ring(K)
    777             sage: [E.tamagawa_exponent(P) for P in K(11).support()]
    778             [10]
    779         """
    780         if proof is None:
    781             import sage.structure.proof.proof
    782             # We use the "number_field" flag because the actual proof dependence is in Pari's number field functions.
    783             proof = sage.structure.proof.proof.get_flag(None, "number_field")
    784 
    785         return self.local_data(P, proof).tamagawa_exponent()
    786 
    787     def kodaira_symbol(self, P, proof = None):
    788         r"""
    789         Returns the Kodaira Symbol of this elliptic curve at the prime `P`.
    790 
    791         INPUT:
    792 
    793         - ``P`` -- either None or a prime ideal of the base field of self.
    794 
    795         - ``proof`` -- whether to only use provably correct methods
    796           (default controlled by global proof module).  Note that the
    797           proof module is number_field, not elliptic_curves, since the
    798           functions that actually need the flag are in number fields.
    799                      
    800         OUTPUT:
    801            
    802         (string) The Kodaira Symbol of the curve at P.
    803 
    804         EXAMPLES::
    805 
    806             sage: K.<a>=NumberField(x^2-5)
    807             sage: E=EllipticCurve([20, 225, 750, 625*a + 6875, 31250*a + 46875])
    808             sage: bad_primes = E.discriminant().support(); bad_primes
    809             [Fractional ideal (-a),
    810             Fractional ideal (7/2*a - 81/2),
    811             Fractional ideal (a + 52),
    812             Fractional ideal (2)]
    813             sage: [E.kodaira_symbol(P) for P in bad_primes]
    814             [I0, I1, I1, II]
    815             sage: K.<a> = QuadraticField(-11)
    816             sage: E = EllipticCurve('11a1').change_ring(K)
    817             sage: [E.kodaira_symbol(P) for P in K(11).support()]
    818             [I10]
    819         """
    820         if proof is None:
    821             import sage.structure.proof.proof
    822             # We use the "number_field" flag because the actual proof dependence is in Pari's number field functions.
    823             proof = sage.structure.proof.proof.get_flag(None, "number_field")
    824 
    825         return self.local_data(P, proof).kodaira_symbol()
    826 
    827 
    828     def conductor(self):
    829         r"""
    830         Returns the conductor of this elliptic curve as a fractional
    831         ideal of the base field.
    832 
    833         OUTPUT:
    834 
    835         (fractional ideal) The conductor of the curve.
    836 
    837         EXAMPLES::
    838 
    839             sage: K.<i>=NumberField(x^2+1)
    840             sage: EllipticCurve([i, i - 1, i + 1, 24*i + 15, 14*i + 35]).conductor()
    841             Fractional ideal (21*i - 3)
    842             sage: K.<a>=NumberField(x^2-x+3)
    843             sage: EllipticCurve([1 + a , -1 + a , 1 + a , -11 + a , 5 -9*a  ]).conductor()
    844             Fractional ideal (-6*a)
    845 
    846         A not so well known curve with everywhere good reduction::
    847 
    848             sage: K.<a>=NumberField(x^2-38)
    849             sage: E=EllipticCurve([0,0,0, 21796814856932765568243810*a - 134364590724198567128296995, 121774567239345229314269094644186997594*a - 750668847495706904791115375024037711300])
    850             sage: E.conductor()
    851             Fractional ideal (1)
    852 
    853         An example which used to fail (see trac #5307)::
    854 
    855             sage: K.<w>=NumberField(x^2+x+6)
    856             sage: E=EllipticCurve([w,-1,0,-w-6,0])
    857             sage: E.conductor()
    858             Fractional ideal (86304, w + 5898)
    859         """
    860         try:
    861             return self._conductor
    862         except AttributeError:
    863             pass
    864 
    865         # Note: for number fields other than QQ we could initialize
    866         # N=K.ideal(1) or N=OK.ideal(1), which are the same, but for
    867         # K==QQ it has to be ZZ.ideal(1).
    868         OK = self.base_ring().ring_of_integers()
    869         self._conductor = prod([d.prime()**(d.conductor_valuation()) \
    870                                 for d in self.local_data()],\
    871                                OK.ideal(1))
    872         return self._conductor
    873 
    874     def global_minimal_model(self, proof = None):
    875         r"""
    876         Returns a model of self that is integral, minimal at all primes.
    877        
    878         .. note::
    879 
    880            This is only implemented for class number 1.  In general,
    881            such a model may or may not exist.
    882        
    883         INPUT:
    884 
    885         - ``proof`` -- whether to only use provably correct methods
    886           (default controlled by global proof module).  Note that the
    887           proof module is number_field, not elliptic_curves, since the
    888           functions that actually need the flag are in number fields.
    889 
    890         OUTPUT:
    891 
    892         A global integral and minimal model.
    893 
    894         EXAMPLES::
    895 
    896             sage: K.<a> = NumberField(x^2-38)
    897             sage: E = EllipticCurve([0,0,0, 21796814856932765568243810*a - 134364590724198567128296995, 121774567239345229314269094644186997594*a - 750668847495706904791115375024037711300])
    898             sage: E.global_minimal_model()
    899             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
    900         """
    901         if proof is None:
    902             import sage.structure.proof.proof
    903             # We use the "number_field" flag because the actual proof dependence is in Pari's number field functions.
    904             proof = sage.structure.proof.proof.get_flag(None, "number_field")
    905         K = self.base_ring()
    906         if K.class_number() != 1:
    907             raise ValueError, "global minimal models only exist in general for class number 1"
    908 
    909         E = self.global_integral_model()
    910         primes = self.base_ring()(self.discriminant()).support()
    911         for P in primes:
    912             E = E.local_data(P,proof).minimal_model()
    913         return E._tidy_model()
    914 
    915     def reduction(self,place):
    916        r"""
    917        Return the reduction of the elliptic curve at a place of good reduction.
    918        
    919        INPUT:
    920 
    921        - ``place`` -- a prime ideal in the base field of the curve
    922            
    923        OUTPUT:
    924 
    925        An elliptic curve over a finite field, the residue field of the place.
    926 
    927        EXAMPLES::
    928 
    929            sage: K.<i> = QuadraticField(-1)
    930            sage: EK = EllipticCurve([0,0,0,i,i+3])
    931            sage: v = K.fractional_ideal(2*i+3)
    932            sage: EK.reduction(v)
    933            Elliptic Curve defined by y^2  = x^3 + 5*x + 8 over Residue field of Fractional ideal (2*i + 3)
    934            sage: EK.reduction(K.ideal(1+i))     
    935            Traceback (most recent call last):
    936            ... 
    937            AttributeError: The curve must have good reduction at the place.
    938            sage: EK.reduction(K.ideal(2)) 
    939            Traceback (most recent call last):
    940            ... 
    941            AttributeError: The ideal must be prime.
    942        """
    943        K = self.base_field()
    944        OK = K.ring_of_integers()
    945        try:
    946            place = K.ideal(place)
    947        except TypeError:
    948            raise TypeError, "The parameter must be an ideal of the base field of the elliptic curve"
    949        if not place.is_prime():
    950            raise AttributeError, "The ideal must be prime."
    951        disc = self.discriminant()
    952        if not K.ideal(disc).valuation(place) == 0:
    953            raise AttributeError, "The curve must have good reduction at the place."
    954        Fv = OK.residue_field(place)
    955        return self.change_ring(Fv)
    956    
    957261    def _torsion_bound(self,number_of_places = 20):
    958262        r"""
    959263        An upper bound on the order of the torsion subgroup.
  • sage/structure/parent_gens.pyx

    diff -r 6554460dad08 -r d71561904a5a sage/structure/parent_gens.pyx
    a b  
    325325            ValueError: variable names cannot be changed after object creation.       
    326326        """
    327327        if self._element_constructor is not None:
    328             parent.Parent._assign_names(self, names=None, normalize=True)
     328            parent.Parent._assign_names(self, names=names, normalize=True)
    329329            return
    330330        if names is None: return
    331331        if normalize: