Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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.])
Ejemplo n.º 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))
Ejemplo n.º 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))
Ejemplo n.º 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))
Ejemplo n.º 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)
Ejemplo n.º 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.])