本文整理汇总了Python中numpy.polynomial.Polynomial方法的典型用法代码示例。如果您正苦于以下问题:Python polynomial.Polynomial方法的具体用法?Python polynomial.Polynomial怎么用?Python polynomial.Polynomial使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类numpy.polynomial
的用法示例。
在下文中一共展示了polynomial.Polynomial方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_polynomial_str
# 需要导入模块: from numpy import polynomial [as 别名]
# 或者: from numpy.polynomial import Polynomial [as 别名]
def test_polynomial_str(self):
res = str(poly.Polynomial([0, 1]))
tgt = 'poly([0. 1.])'
assert_equal(res, tgt)
示例2: _from_list_
# 需要导入模块: from numpy import polynomial [as 别名]
# 或者: from numpy.polynomial import Polynomial [as 别名]
def _from_list_(self, l, k):
if l[0] == 'PART_TFIELD':
self.data[k] = _ip.interp1d(l[1][0].grids[0], l[1][0].data)
elif l[0] == 'PART_COEFF':
self.data[k] = _P(l[1][0].data)
else:
raise RuntimeError("Unknown or not implemented " +
"partition_functions type encountered")
示例3: __setitem__
# 需要导入模块: from numpy import polynomial [as 别名]
# 或者: from numpy.polynomial import Polynomial [as 别名]
def __setitem__(self, key, data):
if type(data) is list:
self._from_list_(data, key)
elif type(data) in [_P, _ip.interp1d]:
self.data[key] = data
else:
try:
data(self._default_test)
self.data[key] = data
except:
raise RuntimeError("Cannot determine type")
示例4: test_polynomial_str
# 需要导入模块: from numpy import polynomial [as 别名]
# 或者: from numpy.polynomial import Polynomial [as 别名]
def test_polynomial_str(self):
res = str(poly.Polynomial([0, 1]))
tgt = 'poly([0., 1.])'
assert_(res, tgt)
示例5: invertibleroots
# 需要导入模块: from numpy import polynomial [as 别名]
# 或者: from numpy.polynomial import Polynomial [as 别名]
def invertibleroots(ma):
import numpy.polynomial as poly
pr = poly.polyroots(ma)
insideroots = np.abs(pr)<1
if insideroots.any():
pr[np.abs(pr)<1] = 1./pr[np.abs(pr)<1]
pnew = poly.Polynomial.fromroots(pr)
mainv = pn.coef/pnew.coef[0]
wasinvertible = False
else:
mainv = ma
wasinvertible = True
return mainv, wasinvertible
示例6: getpoly
# 需要导入模块: from numpy import polynomial [as 别名]
# 或者: from numpy.polynomial import Polynomial [as 别名]
def getpoly(self, params):
ar = np.r_[[1], -params[:self.nar]]
ma = np.r_[[1], params[-self.nma:]]
import numpy.polynomial as poly
return poly.Polynomial(ar), poly.Polynomial(ma)