# 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


1365  1365  void pari_close() 
1366  1366  void pari_init(size_t parisize, ulong maxprime) 
1367  1367  void pari_init_opts(size_t parisize, ulong maxprime, ulong init_opts) 
1368   void stackdummy(GEN x, long l) 
1369  1368  long gsizebyte(GEN x) 
1370  1369  long gsizeword(GEN x) 
1371  1370  long timer() 
diff git a/sage/libs/pari/gen.pyx b/sage/libs/pari/gen.pyx
a

b


7012  7012  def idealappr(self, x, long flag=0): 
7013  7013  t0GEN(x) 
7014  7014  pari_catch_sig_on() 
7015   return self.new_gen(idealappr(self.g, t0)) 
 7015  return self.new_gen(idealappr0(self.g, t0, flag)) 
7016  7016  
7017  7017  def idealcoprime(self, x, y): 
7018  7018  """ 
diff git a/sage/rings/number_field/number_field.py b/sage/rings/number_field/number_field.py
a

b


5196  5196  sage: P,Q = K.ideal(3).prime_factors() 
5197  5197  sage: P 
5198  5198  Fractional ideal (3, a + 1) 
5199   sage: pi=K.uniformizer(P); pi 
 5199  sage: pi = K.uniformizer(P); pi 
5200  5200  a + 1 
5201  5201  sage: K.ideal(pi).factor() 
5202  5202  (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 
5204  5204  1/2*a + 1/2 
5205  5205  sage: K.ideal(pi).factor() 
5206  5206  (Fractional ideal (2, a + 1))^1 * (Fractional ideal (3, a + 1)) 
… 
… 

5216  5216  [1, 1, 1] 
5217  5217  sage: [ pilist[i] in Plist[i] for i in range(len(Plist)) ] 
5218  5218  [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. 
5219  5240  """ 
5220  5241  if not is_NumberFieldIdeal(P): 
5221  5242  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'") 
5233  5252  
5234  5253  def units(self, proof=None): 
5235  5254  """ 
diff git a/sage/schemes/elliptic_curves/ell_number_field.py b/sage/schemes/elliptic_curves/ell_number_field.py
a

b


595  595  sage: K.<v> = NumberField(x^2 + 161*x  150) 
596  596  sage: E = EllipticCurve([25105/216*v  3839/36, 634768555/7776*v  98002625/1296, 634768555/7776*v  98002625/1296, 0, 0]) 
597  597  sage: E.global_integral_model() 
598   Elliptic Curve defined by y^2 + (33872485050625*v31078224284250)*x*y + (2020602604156076340058146664245468750000*v1871778534673615560803175189398437500000)*y = x^3 + (6933305282258321342920781250*v6422644400723486559914062500)*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*v1414427901517840500)*x^2 over Number Field in v with defining polynomial x^2 + 161*x  150 
599  599  
600  600  :trac:`14476`:: 
601  601  
… 
… 

603  603  sage: K.<g> = NumberField(t^4  t^3  3*t^2  t + 1) 
604  604  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]) 
605  605  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^3958584*g^2166242*g+298101)*y = x^3 + (2859*g^33978*g^2669*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^348*g42)*x*y + (111510*g^3162162*g^244145*g+37638)*y = x^3 + (954*g^31134*g^2+81*g+576)*x^2 over Number Field in g with defining polynomial t^4  t^3  3*t^2  t + 1 
607  607  
608  608  """ 
609  609  K = self.base_field() 