Skip to content

Doctest fix for: Make atan2(0,0) return NaN #21614

@rwst

Description

@rwst

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.

Depends on #21623

Component: symbolics

Author: Ralf Stephan

Branch/Commit: fda5183

Reviewer: Jeroen Demeyer

Issue created by migration from https://trac.sagemath.org/ticket/21614

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions