def get_duration(func, min_, max_):
    """
    Calculate the range of independent variable with opposite sign values
    input:
        func: any equation
        min_, max_: the maximum range of independent variable with opposite sign values

    return: a range(left,right)
    """
    assert max_ > min_
    r = max_ - min_
    div = 2
    step = r / div

    results = [func(min_ + step * i) for i in range(div)]

    for i in range(div - 1):
        if results[i] * results[i + 1] <= 0:
            return (min_ + i * step, min_ + (i + 1) * step)

    return (max_ - step, max_)