Пример #1
0
 def test_trig(self):
     z = interval[-10,
                  10].newton(lambda x: imath.cospi(x / 3) - 0.5,
                             lambda x: -imath.pi * imath.sinpi(x / 3) / 3)
     w = interval(-7, -5, -1, 1, 5, 7)
     assert w in z
     assert max(helpers.ulpwidth(z)) == 4
Пример #2
0
 def test_cospi(self):
     assert imath.cospi(fpu.infinity) == interval[-1, 1]
     assert imath.cospi(-fpu.infinity) == interval[-1, 1]
     assert imath.cospi(interval[0.5, 1.5]) == interval[-1, 0]
     assert imath.cospi(interval[-0.5, 0.5]) == interval[0, 1]
     assert imath.cospi(1/interval[3]) == interval[helpers.nudge(0.5,-2), helpers.nudge(0.5, 1)]
     assert imath.cospi(-1/interval[3]) == interval[helpers.nudge(0.5,-2), helpers.nudge(0.5, 1)]
     assert imath.cospi(2/interval[3]) == interval[helpers.nudge(-0.5,-2), helpers.nudge(-0.5,2)]
     assert imath.cospi(interval[6]**-1) == imath.sqrt(3)/2
Пример #3
0
 def test_cospi(self):
     assert imath.cospi(fpu.infinity) == interval[-1, 1]
     assert imath.cospi(-fpu.infinity) == interval[-1, 1]
     assert imath.cospi(interval[0.5, 1.5]) == interval[-1, 0]
     assert imath.cospi(interval[-0.5, 0.5]) == interval[0, 1]
     assert imath.cospi(1 / interval[3]) == interval[helpers.nudge(0.5, -2),
                                                     helpers.nudge(0.5, 1)]
     assert imath.cospi(-1 /
                        interval[3]) == interval[helpers.nudge(0.5, -2),
                                                 helpers.nudge(0.5, 1)]
     assert imath.cospi(2 /
                        interval[3]) == interval[helpers.nudge(-0.5, -2),
                                                 helpers.nudge(-0.5, 2)]
     assert imath.cospi(interval[6]**-1) == imath.sqrt(3) / 2
Пример #4
0
def initial_state_interval():
    v_0 = interval[1.0, 1.01]
    pos_x_0 = interval[0.3, 0.31]
    pos_y_0 = interval[0.3, 0.31]
    psi_0 = interval[0, 0.01]
    x_d_0 = interval[1, 1]
    y_d_0 = interval[1, 1]
    av = (lambda v, psi, x_d, y_d, pos_x, pos_y: (-1 * v * imath.sinpi(psi) * x_d + y_d * v * imath.cospi(psi) - pos_y * v * imath.cospi(psi))/((x_d - pos_x)**2+(y_d - pos_y)**2))\
    (v_0, psi_0, x_d_0, y_d_0, pos_x_0, pos_y_0)
    return av
Пример #5
0
 def test_trig(self):
     z = interval[-10, 10].newton(lambda x: imath.cospi(x/3) - 0.5, lambda x: -imath.pi * imath.sinpi(x/3) / 3)
     w = interval(-7, -5, -1, 1, 5, 7)
     assert w in z
     assert max(helpers.ulpwidth(z)) == 4