本文整理匯總了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)