Changeset 7442:f3627c90367a
- Timestamp:
- 12/01/07 03:39:38 (5 years ago)
- Branch:
- default
- Parents:
- 7440:3e6bbc9928b6 (diff), 7441:5b6d6e2e4a87 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 2 edited
-
sage/rings/number_field/number_field.py (modified) (1 diff)
-
sage/rings/number_field/number_field.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sage/rings/number_field/number_field.py
r7440 r7442 4627 4627 parts = -b/(2*a), (Dpoly/D).sqrt()/(2*a) 4628 4628 self._NumberField_generic__gen = self._element_class(self, parts) 4629 4630 4631 def coerce_map_from_impl(self, S): 4632 """ 4633 EXAMPLES: 4634 sage: K.<a> = QuadraticField(-3) 4635 sage: f = K.coerce_map_from(QQ); f 4636 Natural morphism: 4637 From: Rational Field 4638 To: Number Field in a with defining polynomial x^2 + 3 4639 sage: f(3/5) 4640 3/5 4641 sage: parent(f(3/5)) is K 4642 True 4643 """ 4644 if S is QQ: 4645 return number_field_element_quadratic.Q_to_quadratic_field_element(self) 4646 else: 4647 return NumberField_absolute.coerce_map_from_impl(self, S) 4648 4649 4629 4650 4630 4651 def discriminant(self, v=None): -
sage/rings/number_field/number_field.py
r7441 r7442 170 170 def NumberField(polynomial, name=None, check=True, names=None, cache=True): 171 171 r""" 172 Return {\emthe} number field defined by the given irreducible172 Return \emph{the} number field defined by the given irreducible 173 173 polynomial and with variable with the given name. If check is 174 174 True (the default), also verify that the defining polynomial is … … 471 471 def is_QuadraticField(x): 472 472 r""" 473 Return True if x is of the quadratic {\emnumber} field type.473 Return True if x is of the quadratic \emph{number} field type. 474 474 475 475 EXAMPLES: … … 1266 1266 gens = I.gens() 1267 1267 return sage.rings.ring.Ring.ideal(self, gens, **kwds) 1268 1269 def ideals_of_bdd_norm(self, bound): 1270 """ 1271 All integral ideals of bounded norm. 1272 1273 INPUT: 1274 bound -- a positive integer 1275 1276 OUTPUT: 1277 A dict of all integral ideals I such that Norm(I) <= bound, 1278 keyed by norm. 1279 1280 EXAMPLE: 1281 sage: K.<a> = NumberField(x^2 + 23) 1282 sage: d = K.ideals_of_bdd_norm(10) 1283 sage: for n in d: 1284 ... print n 1285 ... for I in d[n]: 1286 ... print I 1287 1 1288 Fractional ideal (1) 1289 2 1290 Fractional ideal (2, 1/2*a - 1/2) 1291 Fractional ideal (2, 1/2*a + 1/2) 1292 3 1293 Fractional ideal (3, -1/2*a + 1/2) 1294 Fractional ideal (3, -1/2*a - 1/2) 1295 4 1296 Fractional ideal (4, 1/2*a + 3/2) 1297 Fractional ideal (2) 1298 Fractional ideal (4, 1/2*a + 5/2) 1299 5 1300 6 1301 Fractional ideal (-1/2*a + 1/2) 1302 Fractional ideal (6, 1/2*a + 5/2) 1303 Fractional ideal (6, 1/2*a + 7/2) 1304 Fractional ideal (1/2*a + 1/2) 1305 7 1306 8 1307 Fractional ideal (-1/2*a - 3/2) 1308 Fractional ideal (4, a - 1) 1309 Fractional ideal (4, a + 1) 1310 Fractional ideal (1/2*a - 3/2) 1311 9 1312 Fractional ideal (9, 1/2*a + 11/2) 1313 Fractional ideal (3) 1314 Fractional ideal (9, 1/2*a + 7/2) 1315 10 1316 1317 """ 1318 from sage.rings.number_field.number_field_ideal import convert_from_zk_basis 1319 hnf_ideals = pari('ideallist(%s, %d)'%(self.pari_nf(),bound)) 1320 d = {} 1321 for i in xrange(bound): 1322 d[i+1] = [self.ideal([ self(generator) for generator in convert_from_zk_basis(self, hnf_I) ]) for hnf_I in hnf_ideals[i]] 1323 return d 1268 1324 1269 1325 def _is_valid_homomorphism_(self, codomain, im_gens): … … 2053 2109 """ 2054 2110 return infinity.infinity 2055 2111 2056 2112 def polynomial_ntl(self): 2057 2113 """ … … 3623 3679 return K 3624 3680 3681 def absolute_polynomial_ntl(self): 3682 """ 3683 Return defining polynomial of this number field 3684 as a pair, an ntl polynomial and a denominator. 3685 3686 This is used mainly to implement some internal arithmetic. 3687 3688 EXAMPLES: 3689 sage: NumberField(x^2 + (2/3)*x - 9/17,'a').polynomial_ntl() 3690 ([-27 34 51], 51) 3691 """ 3692 try: 3693 return (self.__abs_polynomial_ntl, self.__abs_denominator_ntl) 3694 except AttributeError: 3695 self.__abs_denominator_ntl = ntl.ZZ() 3696 den = self.absolute_polynomial().denominator() 3697 self.__abs_denominator_ntl.set_from_sage_int(ZZ(den)) 3698 self.__abs_polynomial_ntl = ntl.ZZX((self.absolute_polynomial()*den).list()) 3699 return (self.__abs_polynomial_ntl, self.__abs_denominator_ntl) 3700 3625 3701 def absolute_polynomial(self): 3626 3702 r"""
Note: See TracChangeset
for help on using the changeset viewer.
