GitLab Commit is coming up on August 3-4. Learn how to innovate together using GitLab, the DevOps platform. Register for free: gitlabcommitvirtual2021.com

Commits (4)
......@@ -1079,11 +1079,20 @@ class JacobiAmplitude(BuiltinFunction):
sage: jacobi_am(3, 4.)
-0.339059208303591
"""
if m == 0:
from sage.structure.element import parent, coercion_model
from sage.symbolic.ring import SR
if SR(m).is_trivial_zero():
return x
elif x == 0:
elif SR(x).is_trivial_zero():
return Integer(0)
return
if not SR(x).is_numeric() or not SR(m).is_numeric():
return
P = coercion_model.common_parent(x, m)
try:
if P is float or P is complex or not P.is_exact():
return self._evalf_(x, m, P)
except AttributeError:
pass
def _evalf_(self, x, m, parent, algorithm=None):
r"""
......
......@@ -609,7 +609,20 @@ class EllipticEU(BuiltinFunction):
sage: elliptic_eu(1,1)
elliptic_eu(1, 1)
"""
pass
from sage.structure.element import parent, coercion_model
from sage.symbolic.ring import SR
if SR(u).is_trivial_zero():
return m
elif SR(m).is_trivial_zero():
return Integer(0)
if not SR(u).is_numeric() or not SR(m).is_numeric():
return
P = coercion_model.common_parent(u, m)
try:
if P is float or P is complex or not P.is_exact():
return self._evalf_(u, m, P)
except AttributeError:
pass
def _evalf_(self, u, m, parent=None, algorithm=None):
"""
......
......@@ -1822,20 +1822,21 @@ cdef py_atan2(x, y):
-1.8925468811915387
"""
from sage.symbolic.constants import pi, NaN
from sage.functions.all import atan, log, sqrt
P = coercion_model.common_parent(x, y)
if P is ZZ:
P = RR
if y != 0:
if RR.has_coerce_map_from(P):
if x > 0:
res = py_atan(abs(y/x))
res = atan(abs(y/x))
elif x < 0:
res = P(pi) - py_atan(abs(y/x))
res = P(pi) - atan(abs(y/x))
else:
res = P(pi)/2
return res if y > 0 else -res
else:
return -I*py_log((x + I*y)/py_sqrt(x**2 + y**2))
return P(-I*log((x + I*y)/sqrt(x**2 + y**2)))
else:
if x > 0:
return P(0)
......