# Ticket #12950: trac_11423-atan_error-trac.patch

File trac_11423-atan_error-trac.patch, 2.7 KB (added by jpflori, 9 years ago)
• ## sage/functions/other.py

```# HG changeset patch
# User Titus Nicolae <nicolaetitus12@gmail.com>
# Date 1336851175 -7200
# Node ID 329827139f0960a2427141901bd58c3315c95e46
# Parent  6eda1f634b03c9b725a1bacd854d85b1aa22df90
Trac #12950: Doctest changes after atan(0,0) started raising an error in Pynac.

diff --git a/sage/functions/other.py b/sage/functions/other.py```
 a arg(sqrt(2) + I) """ if not isinstance(x,Expression): # x contains no variables if is_inexact(x): # inexact complex numbers, e.g. 2.0+i return self._evalf_(x, parent(x)) if not isinstance(x,Expression): # x contains no variables if parent(x)(0)==x: #compatibility with maxima return parent(x)(0) else: # exact complex numbers, e.g. 2+i return arctan2(imag_part(x),real_part(x)) if is_inexact(x): # inexact complex numbers, e.g. 2.0+i return self._evalf_(x, parent(x)) else:  # exact complex numbers, e.g. 2+i return arctan2(imag_part(x),real_part(x)) else: # x contains variables, e.g. 2+i+y or 2.0+i+y # or x involves an expression such as sqrt(2)
• ## sage/functions/trig.py

`diff --git a/sage/functions/trig.py b/sage/functions/trig.py`
 a sage: arctan2(0, -log(2)).n() 3.14159265358979 Check if atan2(0,0) throws error #11423:: sage: atan2(0,0) Traceback (most recent call last): ... RuntimeError: arctan2_eval(): arctan2(0,0) encountered sage: atan2(0,0,hold=True) arctan2(0, 0) sage: atan2(0,0,hold=True).n() Traceback (most recent call last): ... ValueError: arctan2(0,0) undefined """ GinacFunction.__init__(self, "arctan2", nargs=2, latex_name=r'\arctan', conversions=dict(maxima='atan2', sympy='atan2'))
• ## sage/symbolic/expression.pyx

`diff --git a/sage/symbolic/expression.pyx b/sage/symbolic/expression.pyx`
 a 0.0 sage: maxima('atan2(0,0.6)') 0.0 sage: SR(0).arctan2(0) 0 sage: SR(0).arctan2(0) #11423 Traceback (most recent call last): ... RuntimeError: arctan2_eval(): arctan2(0,0) encountered sage: SR(I).arctan2(1) arctan2(I, 1) sage: SR(CDF(0,1)).arctan2(1)