# HG changeset patch
# User David Loeffler <d.loeffler.01@cantab.net>
# Date 1295975834 0
# Node ID 039c566589b663700f313ab0cecac96289334b8e
# Parent 063ffd2a1aa7c0aaf2f7548513dc8ee546a0a108
#8721: Residue fields for relative number fields broken (again)
diff r 063ffd2a1aa7 r 039c566589b6 sage/rings/number_field/number_field_ideal.py
a

b


2760  2760  sage: R(1/b) 
2761  2761  2*abar 
2762  2762  
 2763  We verify that #8721 is fixed:: 
 2764  
 2765  sage: L.<a, b> = NumberField([x^2  3, x^2  5]) 
 2766  sage: L.ideal(a).residue_field() 
 2767  Residue field in abar of Fractional ideal (a) 
2763  2768  """ 
2764  2769  if not self.is_prime(): 
2765  2770  raise ValueError, "The ideal must be prime" 
… 
… 

2887  2892  self.__OK = OK 
2888  2893  self.__Q = Q 
2889  2894  self.__M_OK_map = M_OK_map 
 2895  self.__Kgen = OK.number_field().absolute_generator() 
2890  2896  
2891  2897  def __call__(self, x): 
2892  2898  """ 
… 
… 

2899  2905  sage: f = R.lift_map() 
2900  2906  sage: f(R(a/17)) 
2901  2907  1 
 2908  
 2909  A relative example, which used to fail but is fixed by #8721:: 
 2910  
 2911  sage: L.<a, b> = NumberField([x^2 + 1, x^2  5]) 
 2912  sage: p = L.ideal(2*a + 3) 
 2913  sage: V, to_V, from_V = p._p_quotient(13) 
 2914  sage: from_V(V.0) 
 2915  (1/2*b + 7/2)*a  1/2*b + 3/2 
2902  2916  """ 
2903  2917  # This lifts to OK tensor F_p 
2904  2918  v = self.__Q.lift(x) 
2905  2919  # This lifts to ZZ^n (= OK) 
2906  2920  w = v.lift() 
2907  2921  # Write back in terms of K 
2908   z = w * self.__M_OK_map 
2909   return self.__OK(z.list()) 
 2922  z = (w * self.__M_OK_map).list() 
 2923  return self.__OK(sum([z[i] * self.__Kgen**i for i in xrange(len(z))])) 
2910  2924  
2911  2925  def __repr__(self): 
2912  2926  """ 