def test_general_segment(self): H = x**2 + y self.assertEqual(newton_data(H), [(1, 1, 1, x)]) H = x**3 + y**2 self.assertEqual(newton_data(H), [(1, 1, 2, x**2)]) H = x**5 + y**3 self.assertEqual(newton_data(H), [(1, 1, 3, x**3)])
def test_general_to_colinear(self): H = 2 * x**5 + 3 * x**2 * y**2 + 5 * y**4 self.assertEqual(newton_data(H), [(1, 1, 4, 5 * x**4 + 3 * x**2)]) H = 2 * x**5 + 3 * x**3 * y + 5 * x**2 * y**2 + 7 * y**4 self.assertEqual(newton_data(H), [(1, 1, 4, 7 * x**4 + 5 * x**2 + 3 * x)]) H = 2 * x**5 + 3 * x**3 * y + 5 * x**2 * y**2 + 7 * y**6 self.assertEqual(newton_data(H), [(1, 1, 4, 5 * x**2 + 3 * x), (2, 1, 6, 7 * x**2 + 5)])
def test_colinear(self): H = 2 * x**4 + 3 * x**2 * y**2 + 5 * y**4 self.assertEqual(newton_data(H), [(1, 1, 4, 5 * x**4 + 3 * x**2 + 2)]) H = 2 * x**4 + 3 * x**3 * y + 5 * x**2 * y**2 + 7 * y**4 self.assertEqual(newton_data(H), [(1, 1, 4, 7 * x**4 + 5 * x**2 + 3 * x + 2)]) H = 2 * x**4 + 3 * x**2 * y**2 + 5 * x * y**3 + 7 * y**4 self.assertEqual(newton_data(H), [(1, 1, 4, 7 * x**4 + 5 * x**3 + 3 * x**2 + 2)])
def test_segment(self): H = 2 * x + 3 * y self.assertEqual(newton_data(H), [(1, 1, 1, 3 * x + 2)]) H = 2 * x**2 + 3 * y**2 self.assertEqual(newton_data(H), [(1, 1, 2, 3 * x**2 + 2)]) H = 2 * x**2 + 3 * y**3 self.assertEqual(newton_data(H), [(3, 2, 6, 3 * x + 2)]) H = 2 * x**2 + 3 * y**4 self.assertEqual(newton_data(H), [(2, 1, 4, 3 * x**2 + 2)])
def test_colinear(self): H = 2*x**4 + 3*x**2*y**2 + 5*y**4 self.assertEqual(newton_data(H), [(1, 1, 4, 5*x**4 + 3*x**2 + 2)]) H = 2*x**4 + 3*x**3*y + 5*x**2*y**2 + 7*y**4 self.assertEqual(newton_data(H), [(1, 1, 4, 7*x**4 + 5*x**2 + 3*x + 2)]) H = 2*x**4 + 3*x**2*y**2 + 5*x*y**3 + 7*y**4 self.assertEqual(newton_data(H), [(1, 1, 4, 7*x**4 + 5*x**3 + 3*x**2 + 2)])
def test_general_to_colinear(self): H = 2*x**5 + 3*x**2*y**2 + 5*y**4 self.assertEqual(newton_data(H), [(1, 1, 4, 5*x**4 + 3*x**2)]) H = 2*x**5 + 3*x**3*y + 5*x**2*y**2 + 7*y**4 self.assertEqual(newton_data(H), [(1, 1, 4, 7*x**4 + 5*x**2 + 3*x)]) H = 2*x**5 + 3*x**3*y + 5*x**2*y**2 + 7*y**6 self.assertEqual(newton_data(H), [(1, 1, 4, 5*x**2 + 3*x), (2, 1, 6, 7*x**2 + 5)])
def test_segment(self): H = 2*x + 3*y self.assertEqual(newton_data(H), [(1, 1, 1, 3*x + 2)]) H = 2*x**2 + 3*y**2 self.assertEqual(newton_data(H), [(1, 1, 2, 3*x**2 + 2)]) H = 2*x**2 + 3*y**3 self.assertEqual(newton_data(H), [(3, 2, 6, 3*x + 2)]) H = 2*x**2 + 3*y**4 self.assertEqual(newton_data(H), [(2, 1, 4, 3*x**2 + 2)])
def test_multiple(self): H = 2 * x**2 + 3 * x * y + 5 * y**3 self.assertEqual(newton_data(H), [(1, 1, 2, 3 * x + 2), (2, 1, 3, 5 * x + 3)])
def test_multiple(self): H = 2*x**2 + 3*x*y + 5*y**3 self.assertEqual(newton_data(H), [(1, 1, 2, 3*x + 2), (2, 1, 3, 5*x + 3)])