コード例 #1
0
ファイル: test_extra.py プロジェクト: dpsanders/pyinterval
 def test_atan(self):
     pi4p = helpers.nudge(math.pi / 2, +1)
     self.assertEqual(imath.atan(interval[-fpu.infinity, fpu.infinity]),
                      interval([-pi4p, pi4p]))
     self.assertEqual(imath.atan(1),
                      interval[math.pi / 4,
                               helpers.nudge(math.pi / 4, +1)])
コード例 #2
0
def initial_alpha_r_interval(model, v_y_I, yaw_dot_I, v_x_I):
    '''
       Function: compute the interval of beta for the kinematic bicycle model
       Input: intervals of vy, yaw_dot, vx
    '''
    L_f = model.L_f
    fun = lambda v_y, yaw_dot, v_x: imath.atan((v_y - L_f * yaw_dot) / v_x)
    alpha_r = fun(v_y_I, yaw_dot_I, v_x_I)
    return [alpha_r[0][0], alpha_r[0][1]]
コード例 #3
0
def initial_state_interval(delta, uncertainty):
    global L
    global L_f
    global L_r
    delta_0 = interval[delta - uncertainty, delta + uncertainty]
    beta = (lambda delta: imath.atan(L_r * imath.tan(delta) / L))(delta_0)
    beta_min = min(beta[0][0], beta[0][1])
    beta_max = max(beta[0][0], beta[0][1])
    return [beta_min, beta_max]
コード例 #4
0
def initial_beta_interval(model, delta_I):
    '''
       Function: compute the interval of beta for the kinematic bicycle model
       Input: steering angle interval
    '''
    L = model.L
    L_r = model.L_r
    beta = (lambda delta: imath.atan(L_r * imath.tan(delta) / L))(delta_I)
    beta_min = min(beta[0][0], beta[0][1])
    beta_max = max(beta[0][0], beta[0][1])
    return [beta_min, beta_max]
コード例 #5
0
ファイル: test_extra.py プロジェクト: dorellang/pyinterval
 def test_atan(self):
     pi4p = helpers.nudge(math.pi / 2, +1)
     self.assertEqual(imath.atan(interval[-fpu.infinity, fpu.infinity]),
                      interval([-pi4p, pi4p]))
     self.assertEqual(imath.atan(1), interval[math.pi / 4, helpers.nudge(math.pi / 4, +1)])
コード例 #6
0
ファイル: test_extra.py プロジェクト: akshatd/pyinterval
 def test_atan(self):
     pi4p = helpers.nudge(math.pi / 2, +1)
     assert imath.atan(interval[-fpu.infinity, fpu.infinity]) == interval([-pi4p, pi4p])
     assert imath.atan(1)                                     == interval[math.pi / 4, helpers.nudge(math.pi / 4, +1)]
コード例 #7
0
ファイル: contractor_newton.py プロジェクト: dsksh/ICPy
    def __eval(self, n_id, box):
        n = self.__dag[n_id]

        rec = self.__eval

        if n[0] == '+':
            v1 = rec(n[1], box)
            v2 = rec(n[2], box)
            return v1 + v2
        elif n[0] == '-':
            v1 = rec(n[1], box)
            v2 = rec(n[2], box)
            return v1 - v2
        elif n[0] == '*':
            v1 = rec(n[1], box)
            v2 = rec(n[2], box)
            return v1 * v2
        elif n[0] == '/':
            v1 = rec(n[1], box)
            v2 = rec(n[2], box)
            return v1 / v2

        elif n[0] == '^':
            v = rec(n[1], box)
            i = self.__dag[n[2]][1]
            return v**i

        elif n[0] == 'exp':
            v = rec(n[1], box)
            return imath.exp(v)

        elif n[0] == 'log':
            v = rec(n[1], box)
            return imath.log(v)

        elif n[0] == 'sqrt':
            v = rec(n[1], box)
            return imath.sqrt(v)

        elif n[0] == 'sin':
            v = rec(n[1], box)
            return imath.sin(v)

        elif n[0] == 'cos':
            v = rec(n[1], box)
            return imath.cos(v)

        elif n[0] == 'tan':
            v = rec(n[1], box)
            return imath.tan(v)

        elif n[0] == 'asin':
            v = rec(n[1], box)
            return imath.asin(v)

        elif n[0] == 'acos':
            v = rec(n[1], box)
            return imath.acos(v)

        elif n[0] == 'atan':
            v = rec(n[1], box)
            return imath.atan(v)

        elif n[0] == 'sinh':
            v = rec(n[1], box)
            return imath.sinh(v)

        elif n[0] == 'cosh':
            v = rec(n[1], box)
            return imath.cosh(v)

        elif n[0] == 'tanh':
            v = rec(n[1], box)
            return imath.tanh(v)

        elif n[0] == 'C':
            return interval[n[1]]
        elif n[0] == 'V':
            return box[n[1]]
        else:
            print('unsupported node: ' + str(n))
            assert (False)
コード例 #8
0
 def test_atan(self):
     pi4p = helpers.nudge(math.pi / 2, +1)
     assert imath.atan(interval[-fpu.infinity,
                                fpu.infinity]) == interval([-pi4p, pi4p])
     assert imath.atan(1) == interval[math.pi / 4,
                                      helpers.nudge(math.pi / 4, +1)]