示例#1
0
 def test_lagfromroots(self) :
     res = lag.lagfromroots([])
     assert_almost_equal(trim(res), [1])
     for i in range(1, 5) :
         roots = np.cos(np.linspace(-np.pi, 0, 2*i + 1)[1::2])
         pol = lag.lagfromroots(roots)
         res = lag.lagval(roots, pol)
         tgt = 0
         assert_(len(pol) == i + 1)
         assert_almost_equal(lag.lag2poly(pol)[-1], 1)
         assert_almost_equal(res, tgt)
示例#2
0
 def test_lagfromroots(self):
     res = lag.lagfromroots([])
     assert_almost_equal(trim(res), [1])
     for i in range(1, 5):
         roots = np.cos(np.linspace(-np.pi, 0, 2 * i + 1)[1::2])
         pol = lag.lagfromroots(roots)
         res = lag.lagval(roots, pol)
         tgt = 0
         assert_(len(pol) == i + 1)
         assert_almost_equal(lag.lag2poly(pol)[-1], 1)
         assert_almost_equal(res, tgt)
示例#3
0
 def test_lagroots(self) :
     assert_almost_equal(lag.lagroots([1]), [])
     assert_almost_equal(lag.lagroots([0, 1]), [1])
     for i in range(2, 5) :
         tgt = np.linspace(0, 3, i)
         res = lag.lagroots(lag.lagfromroots(tgt))
         assert_almost_equal(trim(res), trim(tgt))
示例#4
0
 def test_lagroots(self):
     assert_almost_equal(lag.lagroots([1]), [])
     assert_almost_equal(lag.lagroots([0, 1]), [1])
     for i in range(2, 5):
         tgt = np.linspace(0, 3, i)
         res = lag.lagroots(lag.lagfromroots(tgt))
         assert_almost_equal(trim(res), trim(tgt))