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 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 mycos(x): """ Interval cos :param x: interval :return: interval cos(x) """ return ival.cos(x)
def __init__(self, eother): self.x = eother.x self.value = math.sin(eother.value) y = interval.cos(self.range) L = getLip(y) self.L = L * eother.L self.compbnd()
def __init__(self, eother): self.x = eother.x self.value = math.sin(eother.value) y = interval.cos(self.x) print(self.x) L = getLip(y) # L = 1 print(L) self.L = L * eother.L self.compbnd()
def testCos(self): x = interval.Interval([-1, 2 * math.pi/3]) z = interval.cos(x) for i in range(len(z.x)): self.assertAlmostEqual(z.x[i], [-0.5,1][i])