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
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
def test_sinpi(self): assert imath.sinpi(fpu.infinity) == interval[-1, 1] assert imath.sinpi(-fpu.infinity) == interval[-1, 1] assert imath.sinpi(interval[0, 1]) == interval[0, 1] assert imath.sinpi(interval[-1, 0]) == interval[-1, 0] assert imath.sinpi(1/interval[6]) == interval[helpers.nudge(0.5,-1), helpers.nudge(0.5, 1)] assert imath.sinpi(1/interval[-6]) == interval[helpers.nudge(-0.5,-1), helpers.nudge(-0.5, 1)]
def test_sinpi(self): assert imath.sinpi(fpu.infinity) == interval[-1, 1] assert imath.sinpi(-fpu.infinity) == interval[-1, 1] assert imath.sinpi(interval[0, 1]) == interval[0, 1] assert imath.sinpi(interval[-1, 0]) == interval[-1, 0] assert imath.sinpi(1 / interval[6]) == interval[helpers.nudge(0.5, -1), helpers.nudge(0.5, 1)] assert imath.sinpi(1 / interval[-6]) == interval[helpers.nudge(-0.5, -1), helpers.nudge(-0.5, 1)]
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