You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a (7-year-old) TODO comment in the implementation of atan2 which acknowledges that "ideally the answer should depend on the signs of num and dem". Currently, for example, if a is symbolic then atan2(a,a) evaluates to pi/4, whereas the correct value is dependent on the sign of a. So atan2(-1,-1) gives a different result from that obtained by substituting -1 for a in the expression.
The comment mentions is_positive and is_negative but perhaps sign is enough to fix this issue?
The text was updated successfully, but these errors were encountered:
I think we need to do what sympy does, which is to simply return atan2(a, a). If a is real and non-zero we can refine it using the refine-function, but for general complex a including a=0 I don't think it is desired or even possible to auto-simplify.
But, is atan2(y,x) even defined for non-real arguments? I suppose it could be defined as the principal value of the argument of x + i y for complex x and y, though most implementations including std::atan2 restrict to the reals.
One simplification that can be made is to cancel common factors that are positive constants, like sqrt(2), but I don't know how easy this is to implement.
There is a (7-year-old) TODO comment in the implementation of
atan2
which acknowledges that "ideally the answer should depend on the signs ofnum
anddem
". Currently, for example, ifa
is symbolic thenatan2(a,a)
evaluates to pi/4, whereas the correct value is dependent on the sign ofa
. Soatan2(-1,-1)
gives a different result from that obtained by substituting -1 fora
in the expression.The comment mentions
is_positive
andis_negative
but perhapssign
is enough to fix this issue?The text was updated successfully, but these errors were encountered: