本文整理匯總了Python中pychebfun.Chebfun.polyfit方法的典型用法代碼示例。如果您正苦於以下問題:Python Chebfun.polyfit方法的具體用法?Python Chebfun.polyfit怎麽用?Python Chebfun.polyfit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pychebfun.Chebfun
的用法示例。
在下文中一共展示了Chebfun.polyfit方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_chebpolyfit
# 需要導入模塊: from pychebfun import Chebfun [as 別名]
# 或者: from pychebfun.Chebfun import polyfit [as 別名]
def test_chebpolyfit(self):
N = 32
data = np.random.rand(N-1, 2)
coeffs = Chebfun.polyfit(data)
result = Chebfun.polyval(coeffs)
npt.assert_allclose(data, result)
示例2: test_chebpolyfitval
# 需要導入模塊: from pychebfun import Chebfun [as 別名]
# 或者: from pychebfun.Chebfun import polyfit [as 別名]
def test_chebpolyfitval(self, N=64):
data = np.random.rand(N-1, 2)
computed = Chebfun.polyval(Chebfun.polyfit(data))
npt.assert_allclose(computed, data)
示例3: test_vector
# 需要導入模塊: from pychebfun import Chebfun [as 別名]
# 或者: from pychebfun.Chebfun import polyfit [as 別名]
def test_vector(self):
for datalen in [1,3]:
coeffs = Chebfun.polyfit(np.ones([datalen, 2]))
self.assertEqual(len(coeffs.shape), 2)
示例4: test_list
# 需要導入模塊: from pychebfun import Chebfun [as 別名]
# 或者: from pychebfun.Chebfun import polyfit [as 別名]
def test_list(self):
data = [[1.,2], [3,4]]
adata = np.array(data)
result = Chebfun.polyfit(data)
expected = Chebfun.polyfit(adata)
npt.assert_array_almost_equal(result, expected)
示例5: test_scalar
# 需要導入模塊: from pychebfun import Chebfun [as 別名]
# 或者: from pychebfun.Chebfun import polyfit [as 別名]
def test_scalar(self):
for datalen in [1,3]:
coeffs = Chebfun.polyfit(np.ones([datalen]))
self.assertEqual(len(coeffs.shape), 1)