def acos(x):
 np = import_module('numpy')
 if isinstance(x, (int, float)):
  if (abs(x) > 1):
   return interval((- np.inf), np.inf, is_valid=False)
  else:
   return interval(np.arccos(x), np.arccos(x))
 elif isinstance(x, interval):
  if ((x.is_valid is False) or (x.start > 1) or (x.end < (-1))):
   return interval((- np.inf), np.inf, is_valid=False)
  elif ((x.start < (-1)) or (x.end > 1)):
   return interval((- np.inf), np.inf, is_valid=None)
  else:
   start = np.arccos(x.start)
   end = np.arccos(x.end)
   return interval(start, end, is_valid=x.is_valid)

def acos ( x ) : np = import_module ( 'numpy' ) if isinstance ( x , ( int , float ) ) : if ( abs ( x ) > 1 ) : return interval ( ( - np . inf ) , np . inf , is_valid = False ) else : return interval ( np . arccos ( x ) , np . arccos ( x ) ) elif isinstance ( x , interval ) : if ( ( x . is_valid is False ) or ( x . start > 1 ) or ( x . end < ( - 1 ) ) ) : return interval ( ( - np . inf ) , np . inf , is_valid = False ) elif ( ( x . start < ( - 1 ) ) or ( x . end > 1 ) ) : return interval ( ( - np . inf ) , np . inf , is_valid = None ) else : start = np . arccos ( x . start ) end = np . arccos ( x . end ) return interval ( start , end , is_valid = x . is_valid )
evaluates the inverse cos of an interval .