Changeset 7506:e44cd1715483
- Timestamp:
- 12/01/07 15:28:51 (5 years ago)
- Branch:
- default
- Location:
- sage/rings
- Files:
-
- 2 edited
-
number_field/number_field.py (modified) (2 diffs)
-
polynomial/polynomial_element.pyx (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sage/rings/number_field/number_field.py
r7371 r7506 1356 1356 return False 1357 1357 1358 def pari_polynomial(self ):1358 def pari_polynomial(self, name='x'): 1359 1359 """ 1360 1360 PARI polynomial corresponding to polynomial that defines 1361 this field. This is always a polynomial in the variable "x". 1361 this field. By default, this is a polynomial in the 1362 variable "x". 1362 1363 1363 1364 EXAMPLES: … … 1365 1366 sage: k.<a> = NumberField(y^2 - 3/2*y + 5/3) 1366 1367 sage: k.pari_polynomial() 1367 x^2 - 3/2*x + 5/3 1368 x^2 - 3/2*x + 5/3 1369 sage: k.pari_polynomial('a') 1370 a^2 - 3/2*a + 5/3 1368 1371 """ 1369 1372 try: 1370 return self.__pari_polynomial 1373 if (self.__pari_polynomial_var == name): 1374 return self.__pari_polynomial 1375 else: 1376 self.__pari_polynomial = self.__pari_polynomial(name) 1377 self.__pari_polynomial_var = name 1378 return self.__pari_polynomial 1371 1379 except AttributeError: 1372 1380 poly = self.polynomial() 1373 with localvars(poly.parent(), 'x'):1381 with localvars(poly.parent(), name): 1374 1382 self.__pari_polynomial = poly._pari_() 1383 self.__pari_polynomial_var = name 1375 1384 return self.__pari_polynomial 1376 1385 -
sage/rings/polynomial/polynomial_element.pyx
r7423 r7506 1576 1576 return Factorization(v, from_M(F.unit())) 1577 1577 1578 1578 elif is_FiniteField(R): 1579 v = [x._pari_("a") for x in self.list()] 1580 f = pari(v).Polrev() 1581 G = list(f.factor()) 1582 1583 1579 1584 elif is_NumberField(R) or is_FiniteField(R): 1580 1585 v = [x._pari_("a") for x in self.list()] 1581 1586 f = pari(v).Polrev() 1582 G = list( f.factor())1587 G = list(R.pari_polynomial("a").nfinit().nffactor(f)) 1583 1588 1584 1589 elif is_RealField(R): … … 2916 2921 sage: R(4).is_irreducible() 2917 2922 True 2923 2924 TESTS: 2925 sage: F.<t> = NumberField(x^2-5) 2926 sage: Fx.<xF> = PolynomialRing(F) 2927 sage: f = Fx([2*t - 5, 5*t - 10, 3*t - 6, -t, -t + 2, 1]) 2928 sage: f.is_irreducible() 2929 False 2930 sage: f = Fx([2*t - 3, 5*t - 10, 3*t - 6, -t, -t + 2, 1]) 2931 sage: f.is_irreducible() 2932 True 2918 2933 """ 2919 2934 if self.is_zero():
Note: See TracChangeset
for help on using the changeset viewer.
