本文整理汇总了Python中sage.all.PolynomialRing.denominator方法的典型用法代码示例。如果您正苦于以下问题:Python PolynomialRing.denominator方法的具体用法?Python PolynomialRing.denominator怎么用?Python PolynomialRing.denominator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.all.PolynomialRing
的用法示例。
在下文中一共展示了PolynomialRing.denominator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: polredabs
# 需要导入模块: from sage.all import PolynomialRing [as 别名]
# 或者: from sage.all.PolynomialRing import denominator [as 别名]
def polredabs(self):
if "polredabs" in self._data.keys():
return self._data["polredabs"]
else:
pol = PolynomialRing(QQ, 'x')(self.polynomial())
pol *= pol.denominator()
R = pol.parent()
from sage.all import pari
pol = R(pari(pol).polredabs())
self._data["polredabs"] = pol
return pol
示例2: polredabs
# 需要导入模块: from sage.all import PolynomialRing [as 别名]
# 或者: from sage.all.PolynomialRing import denominator [as 别名]
def polredabs(self):
if "polredabs" in self._data.keys():
return self._data["polredabs"]
else:
pol = PolynomialRing(QQ, 'x')(map(str,self.polynomial()))
# Need to map because the coefficients are given as unicode, which does not convert to QQ
pol *= pol.denominator()
R = pol.parent()
from sage.all import pari
pol = R(pari(pol).polredabs())
self._data["polredabs"] = pol
return pol
示例3: poly_to_field_label
# 需要导入模块: from sage.all import PolynomialRing [as 别名]
# 或者: from sage.all.PolynomialRing import denominator [as 别名]
def poly_to_field_label(pol):
try:
pol = PolynomialRing(QQ, 'x')(str(pol))
pol *= pol.denominator()
R = pol.parent()
pol = R(pari(pol).polredabs())
except:
return None
coeffs = list2string([int(c) for c in pol.coeffs()])
d = int(pol.degree())
query = {'coeffs': coeffs}
C = base.getDBConnection()
one = C.numberfields.fields.find_one(query)
if one:
return one['label']
return None
示例4: from_polynomial
# 需要导入模块: from sage.all import PolynomialRing [as 别名]
# 或者: from sage.all.PolynomialRing import denominator [as 别名]
def from_polynomial(cls, pol):
pol = PolynomialRing(QQ, 'x')(str(pol))
pol *= pol.denominator()
R = pol.parent()
pol = R(pari(pol).polredbest().polredabs())
return cls.from_coeffs([int(c) for c in pol.coefficients(sparse=False)])