Ejemplo n.º 1
0
 def test_forward_divided_difference_gaps_auto_step(self):
     """
     Forward divided difference with gaps in walker and auto_step=True.
     """
     orig = [(1, 5), (2, 4), (3, 4), (4, 4), (6, 4), (7, 3), (10, 6)]
     expected = [(1, -1), (2, 0), (3, 0), (6, -1)]
     walker = (('a', p, v) for p, v in orig)
     assert_equal([(p, v) for _, p, v in forward_divided_difference(walker, auto_step=True)], expected)
Ejemplo n.º 2
0
 def test_forward_divided_difference_gaps_step2(self):
     """
     Forward divided difference with gaps in walker and step=2.
     """
     orig = [(1, 5), (2, 4), (3, 4), (4, 4), (6, 4), (8, 3), (10, 6)]
     expected = [(4, 0), (6, -0.5), (8, 1.5)]
     walker = (('a', p, v) for p, v in orig)
     assert_equal([(p, v) for _, p, v in forward_divided_difference(walker, step=2)], expected)
Ejemplo n.º 3
0
 def test_forward_divided_difference(self):
     """
     Simple forward divided difference.
     """
     orig = [(1, 5), (2, 4), (3, 4), (4, 4), (5, 5), (6, 4), (7, 3), (8, 1), (9, 5), (10, 6)]
     expected = [(1, -1), (2, 0), (3, 0), (4, 1), (5, -1), (6, -1), (7, -2), (8, 4), (9, 1)]
     walker = (('a', p, v) for p, v in orig)
     assert_equal([(p, v) for _, p, v in forward_divided_difference(walker)], expected)
Ejemplo n.º 4
0
 def test_forward_divided_difference_gaps_step2(self):
     """
     Forward divided difference with gaps in walker and step=2.
     """
     orig = [(1, 5), (2, 4), (3, 4), (4, 4), (6, 4), (8, 3), (10, 6)]
     expected = [(4, 0), (6, -0.5), (8, 1.5)]
     walker = (('a', p, v) for p, v in orig)
     assert_equal(
         [(p, v) for _, p, v in forward_divided_difference(walker, step=2)],
         expected)
Ejemplo n.º 5
0
 def test_forward_divided_difference_gaps(self):
     """
     Forward divided difference with gaps in walker.
     """
     orig = [(1, 5), (2, 4), (3, 4), (4, 4), (6, 4), (7, 3), (10, 6)]
     expected = [(1, -1), (2, 0), (3, 0), (4, 0), (6, -1), (7, 1)]
     walker = (('a', p, v) for p, v in orig)
     assert_equal([(p, v)
                   for _, p, v in forward_divided_difference(walker)],
                  expected)
Ejemplo n.º 6
0
 def test_forward_divided_difference(self):
     """
     Simple forward divided difference.
     """
     orig = [(1, 5), (2, 4), (3, 4), (4, 4), (5, 5), (6, 4), (7, 3), (8, 1),
             (9, 5), (10, 6)]
     expected = [(1, -1), (2, 0), (3, 0), (4, 1), (5, -1), (6, -1), (7, -2),
                 (8, 4), (9, 1)]
     walker = (('a', p, v) for p, v in orig)
     assert_equal([(p, v)
                   for _, p, v in forward_divided_difference(walker)],
                  expected)