Пример #1
0
 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
0
 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)
Пример #3
0
 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)
Пример #4
0
 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)
Пример #5
0
 def test_from_scalar(self):
     val = np.random.rand()
     cr = chebfun(val)
     ce = Chebfun.from_data([val])
     tools.assert_close(cr, ce)
Пример #6
0
 def test_from_values(self):
     values = np.random.randn(10)
     cr = chebfun(values)
     ce = Chebfun.from_data(values)
     tools.assert_close(cr, ce)
Пример #7
0
 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)
Пример #8
0
 def test_from_scalar(self):
     val = np.random.rand()
     cr = chebfun(val)
     ce = Chebfun.from_data([val])
     tools.assert_close(cr, ce)
Пример #9
0
 def test_from_values(self):
     values = np.random.randn(10)
     cr = chebfun(values)
     ce = Chebfun.from_data(values)
     tools.assert_close(cr, ce)
Пример #10
0
 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)