(x)
Evaluates the square root of an interval
Evaluates the square root of an interval
Evaluates the square root of an interval
def sqrt(x):
    """Evaluates the square root of an interval"""
    np = import_module('numpy')
    if isinstance(x, (int, float)):
        if x > 0:
            return interval(np.sqrt(x))
        else:
            return interval(-np.inf, np.inf, is_valid=False)
    elif isinstance(x, interval):
        #Outside the domain
        if x.end < 0:
            return interval(-np.inf, np.inf, is_valid=False)
        #Partially outside the domain
        elif x.start < 0:
            return interval(-np.inf, np.inf, is_valid=None)
        else:
            return interval(np.sqrt(x.start), np.sqrt(x.end),
                    is_valid=x.is_valid)
    else:
        raise NotImplementedError
def sqrt ( x ) : np = import_module ( 'numpy' ) if isinstance ( x , ( int , float ) ) : if x > 0 : return interval ( np . sqrt ( x ) ) else : return interval ( - np . inf , np . inf , is_valid = False ) elif isinstance ( x , interval ) : #Outside the domain if x . end < 0 : return interval ( - np . inf , np . inf , is_valid = False ) #Partially outside the domain elif x . start < 0 : return interval ( - np . inf , np . inf , is_valid = None ) else : return interval ( np . sqrt ( x . start ) , np . sqrt ( x . end ) , is_valid = x . is_valid ) else : raise NotImplementedError