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