Ejemplo n.º 1
0
 def test_central_divided_difference_gaps_step2(self):
     """
     Central 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 = [(6, -0.25), (8, 0.5)]
     walker = (('a', p, v) for p, v in orig)
     assert_equal([(p, v) for _, p, v in central_divided_difference(walker, step=2)], expected)
Ejemplo n.º 2
0
 def test_central_divided_difference_gaps(self):
     """
     Central divided difference with gaps in walker.
     """
     orig = [(1, 5), (2, 4), (3, 4), (4, 4), (6, 4), (7, 3), (10, 6)]
     expected = [(2, -0.5), (3, 0)]
     walker = (('a', p, v) for p, v in orig)
     assert_equal([(p, v) for _, p, v in central_divided_difference(walker)], expected)
Ejemplo n.º 3
0
 def test_central_divided_difference(self):
     """
     Simple central divided difference.
     """
     orig = [(1, 5), (2, 4), (3, 4), (4, 4), (5, 5), (6, 4), (7, 3), (8, 1), (9, 5), (10, 6)]
     expected = [(2, -0.5), (3, 0), (4, 0.5), (5, 0), (6, -1), (7, -1.5), (8, 1), (9, 2.5)]
     walker = (('a', p, v) for p, v in orig)
     assert_equal([(p, v) for _, p, v in central_divided_difference(walker)], expected)
Ejemplo n.º 4
0
 def test_central_divided_difference_gaps_step2(self):
     """
     Central 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 = [(6, -0.25), (8, 0.5)]
     walker = (('a', p, v) for p, v in orig)
     assert_equal(
         [(p, v) for _, p, v in central_divided_difference(walker, step=2)],
         expected)
Ejemplo n.º 5
0
 def test_central_divided_difference_gaps(self):
     """
     Central divided difference with gaps in walker.
     """
     orig = [(1, 5), (2, 4), (3, 4), (4, 4), (6, 4), (7, 3), (10, 6)]
     expected = [(2, -0.5), (3, 0)]
     walker = (('a', p, v) for p, v in orig)
     assert_equal([(p, v)
                   for _, p, v in central_divided_difference(walker)],
                  expected)
Ejemplo n.º 6
0
 def test_central_divided_difference(self):
     """
     Simple central divided difference.
     """
     orig = [(1, 5), (2, 4), (3, 4), (4, 4), (5, 5), (6, 4), (7, 3), (8, 1),
             (9, 5), (10, 6)]
     expected = [(2, -0.5), (3, 0), (4, 0.5), (5, 0), (6, -1), (7, -1.5),
                 (8, 1), (9, 2.5)]
     walker = (('a', p, v) for p, v in orig)
     assert_equal([(p, v)
                   for _, p, v in central_divided_difference(walker)],
                  expected)