def setUp(self): f = lambda x: sin(30 * x) subinterval = Interval(-2, 3) self.f = f self.ff = Bndfun.initfun_adaptive(f, subinterval) self.xx = subinterval(np.linspace(-1, 1, 100)) self.emptyfun = Bndfun(Chebtech2.initempty(), subinterval) self.constfun = Bndfun(Chebtech2.initconst(1.), subinterval)
def test_size(self): cfs = np.random.rand(10) subinterval = Interval() b0 = Bndfun(Chebtech2(np.array([])), subinterval) b1 = Bndfun(Chebtech2(np.array([1.])), subinterval) b2 = Bndfun(Chebtech2(cfs), subinterval) self.assertEquals(b0.size, 0) self.assertEquals(b1.size, 1) self.assertEquals(b2.size, cfs.size)
def test_onefun_construction(self): coeffs = np.random.rand(10) subinterval = Interval() onefun = Chebtech2(coeffs) f = Bndfun(onefun, subinterval) self.assertIsInstance(f, Bndfun) self.assertLess(infnorm(f.coeffs - coeffs), eps)
def setUp(self): self.emptyfun = Bndfun(Chebtech2.initempty(), Interval()) self.yy = np.linspace(-1, 1, 2000)
def setUp(self): self.emptyfun = Bndfun(Chebtech2.initempty(), Interval()) self.yy = -1 + 2*rand(2000)