Ticket #15243: 15243_uniformizer.patch

File 15243_uniformizer.patch, 5.5 KB (added by jdemeyer, 8 years ago)
  • sage/libs/pari/decl.pxi

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1380554104 -7200
    # Node ID b4306fbb59ae2c323a00ae9bb6a940a065bbde3f
    # Parent  677bcdd0c113352cb802657a199a2e0e578ec820
    Change algorithm for K.uniformizer(P)
    
    diff --git a/sage/libs/pari/decl.pxi b/sage/libs/pari/decl.pxi
    a b  
    13651365    void    pari_close()
    13661366    void    pari_init(size_t parisize, ulong maxprime)
    13671367    void    pari_init_opts(size_t parisize, ulong maxprime, ulong init_opts)
    1368     void    stackdummy(GEN x, long l)
    13691368    long    gsizebyte(GEN x)
    13701369    long    gsizeword(GEN x)
    13711370    long    timer()
  • sage/libs/pari/gen.pyx

    diff --git a/sage/libs/pari/gen.pyx b/sage/libs/pari/gen.pyx
    a b  
    70127012    def idealappr(self, x, long flag=0):
    70137013        t0GEN(x)
    70147014        pari_catch_sig_on()
    7015         return self.new_gen(idealappr(self.g, t0))
     7015        return self.new_gen(idealappr0(self.g, t0, flag))
    70167016
    70177017    def idealcoprime(self, x, y):
    70187018        """
  • sage/rings/number_field/number_field.py

    diff --git a/sage/rings/number_field/number_field.py b/sage/rings/number_field/number_field.py
    a b  
    51965196            sage: P,Q = K.ideal(3).prime_factors()
    51975197            sage: P
    51985198            Fractional ideal (3, a + 1)
    5199             sage: pi=K.uniformizer(P); pi
     5199            sage: pi = K.uniformizer(P); pi
    52005200            a + 1
    52015201            sage: K.ideal(pi).factor()
    52025202            (Fractional ideal (2, a + 1)) * (Fractional ideal (3, a + 1))
    5203             sage: pi=K.uniformizer(P,'negative'); pi
     5203            sage: pi = K.uniformizer(P,'negative'); pi
    52045204            1/2*a + 1/2
    52055205            sage: K.ideal(pi).factor()
    52065206            (Fractional ideal (2, a + 1))^-1 * (Fractional ideal (3, a + 1))
     
    52165216            [1, 1, 1]
    52175217            sage: [ pilist[i] in Plist[i] for i in range(len(Plist)) ]
    52185218            [True, True, True]
     5219
     5220        ::
     5221
     5222            sage: K.<t> = NumberField(x^4 - x^3 - 3*x^2 - x + 1)
     5223            sage: [K.uniformizer(P) for P,e in factor(K.ideal(2))]
     5224            [2]
     5225            sage: [K.uniformizer(P) for P,e in factor(K.ideal(3))]
     5226            [t - 1]
     5227            sage: [K.uniformizer(P) for P,e in factor(K.ideal(5))]
     5228            [t^2 - t + 1, t + 2, t - 2]
     5229            sage: [K.uniformizer(P) for P,e in factor(K.ideal(7))]
     5230            [t^2 + 3*t + 1]
     5231            sage: [K.uniformizer(P) for P,e in factor(K.ideal(67))]
     5232            [t + 23, t + 26, t - 32, t - 18]
     5233
     5234        ALGORITHM:
     5235
     5236            Use PARI. More precisely, use the second component of
     5237            ``idealprimedec`` in the "positive" case. Use `idealappr`
     5238            with exponent of -1 and invert the result in the "negative"
     5239            case.
    52195240        """
    52205241        if not is_NumberFieldIdeal(P):
    52215242            P = self.ideal(P)
    5222         if not P.is_maximal():
    5223             raise ValueError, "P must be a nonzero prime"
    5224         if others == "negative":
    5225             P = ~P
    5226         elif others != "positive":
    5227             raise ValueError, "others must be 'positive' or 'negative'"
    5228         nf = self.pari_nf()
    5229         a = self(nf.idealappr(P.pari_hnf()))
    5230         if others == "negative":
    5231             a = ~a
    5232         return a
     5243        P = P.pari_prime()
     5244        if others == "positive":
     5245            return self(P[1])
     5246        elif others == "negative":
     5247            nf = self.pari_nf()
     5248            F = pari.matrix(1, 2, [P, -1])
     5249            return ~self(nf.idealappr(F, 1))
     5250        else:
     5251            raise ValueError("others must be 'positive' or 'negative'")
    52335252
    52345253    def units(self, proof=None):
    52355254        """
  • 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  
    595595            sage: K.<v> = NumberField(x^2 + 161*x - 150)
    596596            sage: E = EllipticCurve([25105/216*v - 3839/36, 634768555/7776*v - 98002625/1296, 634768555/7776*v - 98002625/1296, 0, 0])
    597597            sage: E.global_integral_model()
    598             Elliptic Curve defined by y^2 + (33872485050625*v-31078224284250)*x*y + (2020602604156076340058146664245468750000*v-1871778534673615560803175189398437500000)*y = x^3 + (6933305282258321342920781250*v-6422644400723486559914062500)*x^2 over Number Field in v with defining polynomial x^2 + 161*x - 150
     598            Elliptic Curve defined by y^2 + (-502639783*v+465618899)*x*y + (-6603604211463489399460860*v+6117229527723443603191500)*y = x^3 + (1526887622075335620*v-1414427901517840500)*x^2 over Number Field in v with defining polynomial x^2 + 161*x - 150
    599599
    600600        :trac:`14476`::
    601601
     
    603603            sage: K.<g> = NumberField(t^4 - t^3 - 3*t^2 - t + 1)
    604604            sage: E = EllipticCurve([ -43/625*g^3 + 14/625*g^2 - 4/625*g + 706/625, -4862/78125*g^3 - 4074/78125*g^2 - 711/78125*g + 10304/78125,  -4862/78125*g^3 - 4074/78125*g^2 - 711/78125*g + 10304/78125, 0,0])
    605605            sage: E.global_integral_model()
    606             Elliptic Curve defined by y^2 + (-18*g^3+29*g^2+63*g+7)*x*y + (-704472*g^3-958584*g^2-166242*g+298101)*y = x^3 + (-2859*g^3-3978*g^2-669*g+1332)*x^2 over Number Field in g with defining polynomial t^4 - t^3 - 3*t^2 - t + 1
     606            Elliptic Curve defined by y^2 + (15*g^3-48*g-42)*x*y + (-111510*g^3-162162*g^2-44145*g+37638)*y = x^3 + (-954*g^3-1134*g^2+81*g+576)*x^2 over Number Field in g with defining polynomial t^4 - t^3 - 3*t^2 - t + 1
    607607
    608608        """
    609609        K = self.base_field()