Beispiel #1
0
 def test_poly_eq(self):
     # Ticket #554
     x = np.poly1d([1, 2, 3])
     y = np.poly1d([3, 4])
     assert_(x != y)
     assert_(x == x)
Beispiel #2
0
 def test_poly_div(self):
     # Ticket #553
     u = np.poly1d([1, 2, 3])
     v = np.poly1d([1, 2, 3, 4, 5])
     q, r = np.polydiv(u, v)
     assert_equal(q*v + r, u)
Beispiel #3
0
 def test_polyder_return_type(self):
     # Ticket #1249
     assert_(isinstance(np.polyder(np.poly1d([1]), 0), np.poly1d))
     assert_(isinstance(np.polyder([1], 0), np.ndarray))
     assert_(isinstance(np.polyder(np.poly1d([1]), 1), np.poly1d))
     assert_(isinstance(np.polyder([1], 1), np.ndarray))
Beispiel #4
0
 def test_poly1d_nan_roots(self):
     # Ticket #396
     p = np.poly1d([np.nan, np.nan, 1], r=0)
     assert_raises(np.linalg.LinAlgError, getattr, p, "r")
Beispiel #5
0
 def test_poly1d(self):
     # Ticket #28
     assert_equal(np.poly1d([1]) - np.poly1d([1, 0]),
                  np.poly1d([-1, 1]))