示例#1
0
 def test_sinh(self):
     self.assertEqual(imath.sinh(0), interval[0])
     assert imath.sinh(1) in ((imath.exp(1) - imath.exp(-1))/2)
示例#2
0
 def check(x):
     x = interval(x)
     z = tanh(x)
     assert z in imath.sinh(x)/imath.cosh(x)
示例#3
0
 def test_sinh(self):
     assert imath.sinh(0) ==  interval[0]
     assert imath.sinh(1) in ((imath.exp(1) - imath.exp(-1)) / 2)
示例#4
0
 def check(x):
     x = interval(x)
     z = tanh(x)
     assert z in imath.sinh(x) / imath.cosh(x)
示例#5
0
 def test_sinh(self):
     self.assertEqual(imath.sinh(0), interval[0])
     assert imath.sinh(1) in ((imath.exp(1) - imath.exp(-1)) / 2)
示例#6
0
    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)
示例#7
0
 def test_sinh(self):
     assert imath.sinh(0) == interval[0]
     assert imath.sinh(1) in ((imath.exp(1) - imath.exp(-1)) / 2)