# HG changeset patch
# User Maite Aranes <M.T.Aranes@warwick.ac.uk>
# Date 1251376341 3600
# Node ID 9fef68d6d829092182a614bfe8f986728f9c87c2
# Parent 684eea91ff224e5bc6259ca19f1576c4c082b9d3
Fix bug in inverse_mod for integral elements of number fields
diff r 684eea91ff22 r 9fef68d6d829 sage/rings/number_field/number_field_element.pyx
a

b


2878  2878  sage: d = 3*a + 1 
2879  2879  sage: d.inverse_mod(N) 
2880  2880  1 
 2881  
 2882  :: 
 2883  
 2884  sage: k.<a> = NumberField(x^3 + 11) 
 2885  sage: d = a + 13 
 2886  sage: d.inverse_mod(a^2) * d  1 in k.ideal(a^2) 
 2887  True 
 2888  sage: d.inverse_mod((5, a + 1))*d  1 in k.ideal(5, a + 1) 
 2889  True 
 2890  
2881  2891  """ 
2882   R = I.number_field().ring_of_integers() 
 2892  k = self.number_field() 
 2893  R = k.ring_of_integers() 
 2894  I = k.ideal(I) 
 2895  
2883  2896  try: 
2884  2897  return I.small_residue(_inverse_mod_generic(R(self), I)) 
2885  2898  except TypeError: 