Beispiel #1
0
 def test_atan(self):
     yl, yu = interval.atan(-0.5, 0.5, -math.inf, math.inf)
     self.assertEqual(yl, -math.inf)
     self.assertEqual(yu, math.inf)
     yl, yu = interval.atan(-0.5, 0.5, -0.1, 0.1)
     self.assertAlmostEqual(yl, -0.1, 12)
     self.assertAlmostEqual(yu, 0.1, 12)
     yl, yu = interval.atan(-0.5, 0.5, -0.5*math.pi+0.1, math.pi/2-0.1)
     self.assertAlmostEqual(yl, math.atan(-0.5), 12)
     self.assertAlmostEqual(yu, math.atan(0.5), 12)
     yl, yu = interval.atan(-0.5, 0.5, -1.5*math.pi+0.1, 1.5*math.pi-0.1)
     self.assertAlmostEqual(yl, math.atan(-0.5)-math.pi, 12)
     self.assertAlmostEqual(yu, math.atan(0.5)+math.pi, 12)
 def test_atan(self):
     yl, yu = interval.atan(-0.5, 0.5, -math.inf, math.inf)
     self.assertEqual(yl, -math.inf)
     self.assertEqual(yu, math.inf)
     yl, yu = interval.atan(-0.5, 0.5, -0.1, 0.1)
     self.assertAlmostEqual(yl, -0.1, 12)
     self.assertAlmostEqual(yu, 0.1, 12)
     yl, yu = interval.atan(-0.5, 0.5, -0.5 * math.pi + 0.1,
                            math.pi / 2 - 0.1)
     self.assertAlmostEqual(yl, math.atan(-0.5), 12)
     self.assertAlmostEqual(yu, math.atan(0.5), 12)
     yl, yu = interval.atan(-0.5, 0.5, -1.5 * math.pi + 0.1,
                            1.5 * math.pi - 0.1)
     self.assertAlmostEqual(yl, math.atan(-0.5) - math.pi, 12)
     self.assertAlmostEqual(yu, math.atan(0.5) + math.pi, 12)
Beispiel #3
0
def _prop_bnds_leaf_to_root_atan(node, bnds_dict):
    """

    Parameters
    ----------
    node: pyomo.core.expr.expr_pyomo5.UnaryFunctionExpression
    bnds_dict: ComponentMap
    """
    assert len(node.args) == 1
    arg = node.args[0]
    lb1, ub1 = bnds_dict[arg]
    bnds_dict[node] = interval.atan(lb1, ub1, -math.inf, math.inf)
Beispiel #4
0
def _prop_bnds_leaf_to_root_atan(node, bnds_dict):
    """

    Parameters
    ----------
    node: pyomo.core.expr.numeric_expr.UnaryFunctionExpression
    bnds_dict: ComponentMap
    """
    assert len(node.args) == 1
    arg = node.args[0]
    lb1, ub1 = bnds_dict[arg]
    bnds_dict[node] = interval.atan(lb1, ub1, -math.inf, math.inf)
Beispiel #5
0
def _prop_bnds_root_to_leaf_tan(node, bnds_dict):
    """

    Parameters
    ----------
    node: pyomo.core.expr.expr_pyomo5.UnaryFunctionExpression
    bnds_dict: ComponentMap
    """
    assert len(node.args) == 1
    arg = node.args[0]
    lb0, ub0 = bnds_dict[node]
    lb1, ub1 = bnds_dict[arg]
    _lb1, _ub1 = interval.atan(lb0, ub0, lb1, ub1)
    if _lb1 > lb1:
        lb1 = _lb1
    if _ub1 < ub1:
        ub1 = _ub1
    bnds_dict[arg] = (lb1, ub1)
Beispiel #6
0
def _prop_bnds_root_to_leaf_tan(node, bnds_dict):
    """

    Parameters
    ----------
    node: pyomo.core.expr.numeric_expr.UnaryFunctionExpression
    bnds_dict: ComponentMap
    """
    assert len(node.args) == 1
    arg = node.args[0]
    lb0, ub0 = bnds_dict[node]
    lb1, ub1 = bnds_dict[arg]
    _lb1, _ub1 = interval.atan(lb0, ub0, lb1, ub1)
    if _lb1 > lb1:
        lb1 = _lb1
    if _ub1 < ub1:
        ub1 = _ub1
    bnds_dict[arg] = (lb1, ub1)