本文整理汇总了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)