Ticket #11630: trac_11630_localize_tates_algorithm.patch

File trac_11630_localize_tates_algorithm.patch, 8.2 KB (added by wuthrich, 9 years ago)

exported against 5.9

  • sage/schemes/elliptic_curves/ell_local_data.py

    # HG changeset patch
    # User Chris Wuthrich <christian.wuthrich@gmail.com>
    # Date 1368526410 -3600
    # Node ID 2f31acea3e1139e55e106da331ba78e3e7d0e3c3
    # Parent  876b0eedb9670a453f7d175d1679f6badf114ea4
    trac #11630 local data does not use global generators
    
    diff --git a/sage/schemes/elliptic_curves/ell_local_data.py b/sage/schemes/elliptic_curves/ell_local_data.py
    a b  
    6161    sage: EK = E.base_extend(K)
    6262    sage: da = EK.local_data(1+i)
    6363    sage: da.minimal_model()
    64     Elliptic Curve defined by y^2 = x^3 + i over Number Field in i with defining polynomial x^2 + 1
     64    Elliptic Curve defined by y^2 = x^3 + (-i) over Number Field in i with defining polynomial x^2 + 1
    6565
    6666REFERENCES:
    6767   
     
    151151
    152152    """
    153153   
    154     def __init__(self, E, P, proof=None, algorithm="pari"):
     154    def __init__(self, E, P, proof=None, algorithm="pari", globally=False):
    155155        r"""
    156156        Initializes the reduction data for the elliptic curve `E` at the prime `P`.
    157157
     
    173173          `\QQ`. If "generic", use the general number field
    174174          implementation.
    175175
     176        - ``globally`` (bool, default: False) -- If True, the algorithm
     177          uses the generators of principal ideals rather than an arbitrary
     178          uniformizer.
     179
    176180        .. note::
    177181
    178182           This function is not normally called directly by users, who
     
    267271            if self._fp>0:
    268272                self._reduction_type = Eint.ap(p) # = 0,-1 or +1
    269273        else:       
    270             self._Emin, ch, self._val_disc, self._fp, self._KS, self._cp, self._split = self._tate(proof)
     274            self._Emin, ch, self._val_disc, self._fp, self._KS, self._cp, self._split = self._tate(proof, globally)
    271275            if self._fp>0:
    272276                if self._Emin.c4().valuation(p)>0:
    273277                    self._reduction_type = 0
     
    604608        """
    605609        return self._reduction_type == 0
    606610       
    607     def _tate(self, proof = None):
     611    def _tate(self, proof = None, globally=False):
    608612        r"""
    609613        Tate's algorithm for an elliptic curve over a number field.
    610614
     
    617621        principal, the minimal model returned will preserve
    618622        integrality at other primes, but not minimality.
    619623
     624        The optional argument globally, when set to True, tells the algorithm to use
     625        the generator of the prime ideal if it is principal. Otherwise just any
     626        uniformizer will be used.
     627
    620628        .. note::
    621629
    622630           Called only by ``EllipticCurveLocalData.__init__()``.
     
    664672            sage: E.tamagawa_number(K.ideal(2))
    665673            4
    666674
     675        This is to show that the bug #11630 is fixed. (The computation
     676        of the class group would produce a warning)::
     677
     678             sage: K.<t> = NumberField(x^7-2*x+177)
     679             sage: E = EllipticCurve([0,1,0,t,t])
     680             sage: P = K.ideal(2,t^3 + t + 1)
     681             sage: E.local_data(P).kodaira_symbol()
     682             II
     683
    667684        """
    668685        E = self._curve
    669686        P = self._prime
     
    683700        # primes, so that we can divide by it without losing
    684701        # integrality at other primes.
    685702
    686         principal_flag = P.is_principal()
    687         if principal_flag:
     703        if globally:
     704            principal_flag = P.is_principal()
     705        else:
     706            principal_flag = False
     707
     708        if (K is QQ) or principal_flag :
    688709            pi = P.gens_reduced()[0]
    689710            verbose("P is principal, generator pi = %s"%pi, t, 1)
    690711        else:
    691712            pi = K.uniformizer(P, 'positive')
    692             verbose("P is not principal, uniformizer pi = %s"%pi, t, 1)
     713            verbose("uniformizer pi = %s"%pi, t, 1)
    693714        pi2 = pi*pi; pi3 = pi*pi2; pi4 = pi*pi3
    694715        pi_neg = None
    695716        prime = pi if K is QQ else P
  • sage/schemes/elliptic_curves/ell_number_field.py

    diff --git a/sage/schemes/elliptic_curves/ell_number_field.py b/sage/schemes/elliptic_curves/ell_number_field.py
    a b  
    667667        raise DeprecationWarning, "local_information is deprecated; use local_data instead"
    668668        return self.local_data(P,proof)
    669669
    670     def local_data(self, P=None, proof = None, algorithm="pari"):
     670    def local_data(self, P=None, proof = None, algorithm="pari", globally=False):
    671671        r"""
    672672        Local data for this elliptic curve at the prime `P`.
    673673
     
    685685          ``ellglobalred`` implementation of Tate's algorithm over
    686686          `\QQ`. If "generic", use the general number field
    687687          implementation.
    688                      
     688
     689        - ``globally`` (boolean, default=False) -- indicates if Tate's
     690          algorithm should use a generator for principal ideals rather
     691          than just a local uniformizer.
     692
    689693        OUTPUT:
    690694
    691695        If `P` is specified, returns the ``EllipticCurveLocalData``
     
    755759        from sage.schemes.elliptic_curves.ell_local_data import check_prime
    756760        P = check_prime(self.base_field(),P)
    757761
    758         return self._get_local_data(P,proof,algorithm)
     762        return self._get_local_data(P,proof,algorithm,globally)
    759763
    760     def _get_local_data(self, P, proof, algorithm="pari"):
     764    def _get_local_data(self, P, proof, algorithm="pari",globally=False):
    761765        r"""
    762766        Internal function to create data for this elliptic curve at the prime `P`.
    763767       
     
    779783          ``ellglobalred`` implementation of Tate's algorithm over
    780784          `\QQ`. If "generic", use the general number field
    781785          implementation.
    782                      
     786
     787        - ``globally`` (boolean, default=False) -- indicates if Tate's
     788          algorithm should use a generator for principal ideals rather
     789          than just a local uniformizer.
     790
    783791        EXAMPLES::
    784792
    785793            sage: K.<i> = NumberField(x^2+1)
     
    803811            False
    804812        """
    805813        try:
    806             return self._local_data[P, proof, algorithm]
     814            return self._local_data[P, proof, algorithm, globally]
    807815        except AttributeError:
    808816            self._local_data = {}
    809817        except KeyError:
    810818            pass
    811819        from sage.schemes.elliptic_curves.ell_local_data import EllipticCurveLocalData
    812         self._local_data[P, proof, algorithm] = EllipticCurveLocalData(self, P, proof, algorithm)
    813         return self._local_data[P, proof, algorithm]
     820        self._local_data[P, proof, algorithm, globally] = EllipticCurveLocalData(self, P, proof, algorithm, globally)
     821        return self._local_data[P, proof, algorithm, globally]
    814822
    815823    def local_minimal_model(self, P, proof = None, algorithm="pari"):
    816824        r"""
     
    830838          ``ellglobalred`` implementation of Tate's algorithm over
    831839          `\QQ`. If "generic", use the general number field
    832840          implementation.
    833                      
     841
    834842        OUTPUT:
    835843
    836844        A model of the curve which is minimal (and integral) at `P`.
     
    839847
    840848           The model is not required to be integral on input.
    841849
    842            For principal `P`, a generator is used as a uniformizer,
    843            and integrality or minimality at other primes is not
    844            affected.  For non-principal `P`, the minimal model
    845            returned will preserve integrality at other primes, but not
    846            minimality.
     850           The minimal model returned will preserve integrality
     851           at other primes, but not minimality.
    847852
    848853        EXAMPLES::
    849854
     
    858863            # We use the "number_field" flag because the actual proof dependence is in PARI's number field functions.
    859864            proof = sage.structure.proof.proof.get_flag(None, "number_field")
    860865
    861         return self.local_data(P, proof, algorithm).minimal_model()
     866        return self.local_data(P, proof, algorithm, globally=False).minimal_model()
    862867
    863868    def has_good_reduction(self, P):
    864869        r"""
     
    13511356        E = self.global_integral_model()
    13521357        primes = E.base_ring()(E.discriminant()).support()
    13531358        for P in primes:
    1354             E = E.local_data(P,proof).minimal_model()
     1359            E = E.local_data(P,proof,globally=True).minimal_model()
    13551360        return E._reduce_model()
    13561361
    13571362    def reduction(self,place):