def test004(self):
     x_0 = 2
     dots = [Dot(-2, 0), Dot(-1, -1), Dot(0, 1), Dot(1, -1), Dot(2, 0)]
     res = Interp.liner(dots, x_0)
     corRes = dots[-1].y
     self.assertEqual(res, corRes)
 def test008(self):
     x_0 = 0.5
     dots = [Dot(-2, 0), Dot(-1, -1), Dot(0, 1), Dot(1, -1), Dot(2, 0)]
     res = Interp.liner(dots, x_0)
     corRes = 0
     self.assertEqual(res, corRes)
Beispiel #3
0
 def extra_0_inter_1 (dots, x_0):
     if x_0 < dots[0].x or x_0 > dots[-1].x:
         return Extrapolation.zero(dots, x_0)
     else:
         return Interpolation.liner(dots, x_0)