def IF(x): return np.array([ mkconst(l) * ival.cos(x[0]) + mkconst(L) * ival.cos(x[2]) - x[4], mkconst(l) * ival.cos(x[1]) + mkconst(L) * ival.cos(x[3]) - x[4] + mkconst(d), mkconst(l) * ival.sin(x[0]) + mkconst(L) * ival.sin(x[2]) - x[5], mkconst(l) * ival.sin(x[1]) + mkconst(L) * ival.sin(x[3]) - x[5] ])
def mysin(x): """ Interval sin :param x: interval :return: interval sin(x) """ return ival.sin(x)
def __init__(self, eother): self.x = eother.x self.value = math.sin(eother.value) self.range = interval.sin(eother.range) if Slope.flagEvalConv: self.conv = False self.conc = False sp = interval.Interval([0, 0]) if eother.value == eother.range[0] or eother.value == eother.range[1]: sp = interval.cos(eother.range) else: pil = math.floor(math.floor(eother.range[0] / math.pi)) piu = math.ceil(math.ceil(eother.range[1] / math.pi)) if piu == pil + 1: if piu % 2 == 0: sp = comp_conc_slope(eother.range[0], eother.range[1], eother.value, math.sin(eother.range[0]), math.sin(eother.range[1]), self.value, math.cos(self.value)) else: sp = comp_conv_slope(eother.range[0], eother.range[1], eother.value, math.sin(eother.range[0]), math.sin(eother.range[1]), self.value, math.cos(eother.value)) else: sp = interval.cos(eother.range) self.S = eother.S * sp if Slope.flagRecompRange: self.comp_slopes_bound()
def testSin(self): x = interval.Interval([-math.pi/6, 2]) z = interval.sin(x) for i in range(len(z.x)): self.assertAlmostEqual(z.x[i], [-0.5,1][i])