Example #1
0
def _set_div(x, y):  # noqa:F811
    """
    Divisions in interval arithmetic
    https://en.wikipedia.org/wiki/Interval_arithmetic
    """
    if (y.start * y.end).is_negative:
        return Interval(-oo, oo)
    if y.start == 0:
        s2 = oo
    else:
        s2 = 1 / y.start
    if y.end == 0:
        s1 = -oo
    else:
        s1 = 1 / y.end
    return set_mul(x, Interval(s1, s2, y.right_open, y.left_open))
Example #2
0
def _set_div(x, y):
    """
    Divisions in interval arithmetic
    https://en.wikipedia.org/wiki/Interval_arithmetic
    """
    from sympy.sets.setexpr import set_mul
    from sympy import oo
    if (y.start * y.end).is_negative:
        return Interval(-oo, oo)
    if y.start == 0:
        s2 = oo
    else:
        s2 = 1 / y.start
    if y.end == 0:
        s1 = -oo
    else:
        s1 = 1 / y.end
    return set_mul(x, Interval(s1, s2, y.right_open, y.left_open))
Example #3
0
def _set_div(x, y):
    """
    Divisions in interval arithmetic
    https://en.wikipedia.org/wiki/Interval_arithmetic
    """
    from sympy.sets.setexpr import set_mul
    from sympy import oo
    if (y.start*y.end).is_negative:
        return Interval(-oo, oo)
    if y.start == 0:
        s2 = oo
    else:
        s2 = 1/y.start
    if y.end == 0:
        s1 = -oo
    else:
        s1 = 1/y.end
    return set_mul(x, Interval(s1, s2, y.right_open, y.left_open))