Example #1
0
 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)
Example #2
0
 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)
Example #3
0
 def test_const(self):
     ff = Chebtech2.initconst(0.)
     gg = Chebtech2.initconst(2.)
     self.assertEquals(ff.roots().size, 0)
     self.assertEquals(gg.roots().size, 0)
Example #4
0
 def test_const_construction(self):
     ff = Chebtech2.initconst(1.)
     self.assertEquals(ff.size, 1)
     self.assertTrue(ff.isconst)
     self.assertFalse(ff.isempty)
     self.assertRaises(ValueError, Chebtech2.initconst, [1.])
Example #5
0
 def test_clenshaw__float_output(self):
     ff = Chebtech2.initconst(1)
     gg = Chebtech2.initconst(1.)
     self.assertTrue(isinstance(ff(0, "clenshaw"), float))
     self.assertTrue(isinstance(gg(0, "clenshaw"), float))
Example #6
0
 def test_clenshaw__float_output(self):
     ff = Chebtech2.initconst(1)
     gg = Chebtech2.initconst(1.)
     self.assertTrue(isinstance(ff(0, "clenshaw"), float))
     self.assertTrue(isinstance(gg(0, "clenshaw"), float))
Example #7
0
 def test_bary__float_output(self):
     ff = Chebtech2.initconst(1)
     gg = Chebtech2.initconst(1.0)
     self.assertTrue(isinstance(ff(0, "bary"), float))
     self.assertTrue(isinstance(gg(0, "bary"), float))
Example #8
0
 def test_const(self):
     ff = Chebtech2.initconst(0.)
     gg = Chebtech2.initconst(2.)
     self.assertEquals(ff.roots().size, 0)
     self.assertEquals(gg.roots().size, 0)
Example #9
0
 def test_const_construction(self):
     ff = Chebtech2.initconst(1.)
     self.assertEquals(ff.size, 1)
     self.assertTrue(ff.isconst)
     self.assertFalse(ff.isempty)
     self.assertRaises(ValueError, Chebtech2.initconst, [1.])