Opened 4 years ago

Last modified 4 years ago

#21614 closed defect

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

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: pynac-0.6.91 Stopgaps:

Description (last modified by rws)

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 would not be of concern if not 3d plotting would likely 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 (1)

comment:1 Changed 4 years ago by rws

  • Dependencies set to pynac-0.6.91
  • Description modified (diff)
Note: See TracTickets for help on using tickets.