Opened 3 years ago

Last modified 3 years ago

#21614 closed defect

Make atan2(0,0) return NaN — at Initial Version

Reported by: rws Owned by:
Priority: minor Milestone: sage-7.4
Component: symbolics Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

Same with tan and imag:

sage: real(sqrt(sin(x)))
sqrt(abs(sin(x)))*cos(1/2*arctan2(cos(real_part(x))*sinh(imag_part(x)), cosh(imag_part(x))*sin(real_part(x))))
sage: _.subs(x==0)
...
RuntimeError: arctan2_eval(): arctan2(0,0) encountered

SymPy expands similarly but gives NaN on substitution instead of an exception.

This all might not be of concern if not 3d plotting would need real/imag parts of a function, their workaround real(...,hold=True) works perfectly but this is not the general solution that is needed.

One solution would be to return NaN instead of throwing up.

Change History (0)

Note: See TracTickets for help on using tickets.