本文整理汇总了Python中pychebfun.Chebfun.from_data方法的典型用法代码示例。如果您正苦于以下问题:Python Chebfun.from_data方法的具体用法?Python Chebfun.from_data怎么用?Python Chebfun.from_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pychebfun.Chebfun
的用法示例。
在下文中一共展示了Chebfun.from_data方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_real_imag
# 需要导入模块: from pychebfun import Chebfun [as 别名]
# 或者: from pychebfun.Chebfun import from_data [as 别名]
def test_real_imag(self):
datar = np.random.rand(10)
datai = np.random.rand(10)
cc = Chebfun.from_data(datar + 1j*datai)
cr = Chebfun.from_data(datar)
ci = Chebfun.from_data(datai)
tools.assert_close(np.real(cc), cr)
tools.assert_close(np.imag(cc), ci)
示例2: test_roots_of_flat_function
# 需要导入模块: from pychebfun import Chebfun [as 别名]
# 或者: from pychebfun.Chebfun import from_data [as 别名]
def test_roots_of_flat_function(self):
"""
Check roots() does not fail for extremely flat Chebfuns such
as those representing cumulative distribution functions.
"""
cdf = Chebfun.from_data(flat_chebfun_vals, domain=[-0.7, 0.7])
npt.assert_allclose((cdf-0.05).roots(), 0.1751682246791747)
示例3: test_from_scalar
# 需要导入模块: from pychebfun import Chebfun [as 别名]
# 或者: from pychebfun.Chebfun import from_data [as 别名]
def test_from_scalar(self):
val = np.random.rand()
cr = chebfun(val)
ce = Chebfun.from_data([val])
tools.assert_close(cr, ce)
示例4: test_from_values
# 需要导入模块: from pychebfun import Chebfun [as 别名]
# 或者: from pychebfun.Chebfun import from_data [as 别名]
def test_from_values(self):
values = np.random.randn(10)
cr = chebfun(values)
ce = Chebfun.from_data(values)
tools.assert_close(cr, ce)
示例5: test_complex
# 需要导入模块: from pychebfun import Chebfun [as 别名]
# 或者: from pychebfun.Chebfun import from_data [as 别名]
def test_complex(self):
n = 10
r = np.random.randn(n) + 1j*np.random.randn(n)
c = Chebfun.from_data(r)
xs = Chebfun.interpolation_points(n)
npt.assert_allclose(c(xs), r)