def eval(cls, y, x): sign_y = C.sign(y) if y.is_zero: if x.is_positive: return S.Zero elif x.is_zero: return S.NaN elif x.is_negative: return S.Pi elif x.is_zero: if sign_y.is_Number: return sign_y * S.Pi/2 else: abs_yx = C.Abs(y/x) if sign_y.is_Number and abs_yx.is_number: phi = C.atan(abs_yx) if x.is_positive: return sign_y * phi else: return sign_y * (S.Pi - phi)
def eval(cls, y, x): sign_y = C.sign(y) if y.is_zero: if x.is_positive: return S.Zero elif x.is_zero: return S.NaN elif x.is_negative: return S.Pi elif x.is_zero: if sign_y.is_Number: return sign_y * S.Pi / 2 else: abs_yx = C.Abs(y / x) if sign_y.is_Number and abs_yx.is_number: phi = C.atan(abs_yx) if x.is_positive: return sign_y * phi else: return sign_y * (S.Pi - phi)
def eval(cls, arg): arg = sympify(arg) if arg.is_Number: if arg is S.NaN: return S.NaN elif arg is S.Zero: return S.Zero elif arg is S.One: return S.Infinity elif arg is S.NegativeOne: return S.NegativeInfinity elif arg.is_negative: return -cls(-arg) else: i_coeff = arg.as_coefficient(S.ImaginaryUnit) if i_coeff is not None: return S.ImaginaryUnit * C.atan(i_coeff) else: coeff, terms = arg.as_coeff_terms() if coeff.is_negative: return -cls(-arg)