Skip to content

Commit

Permalink
Trac #16023: remove deprecated code in functions/ and symbolic/
Browse files Browse the repository at this point in the history
URL: http://trac.sagemath.org/16023
Reported by: rws
Ticket author(s): Ralf Stephan
Reviewer(s): Burcin Erocal, Karl-Dieter Crisman
  • Loading branch information
Release Manager authored and vbraun committed Sep 5, 2014
2 parents ac17396 + 633a411 commit 126311d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 140 deletions.
34 changes: 7 additions & 27 deletions src/sage/functions/exp_integral.py
Expand Up @@ -1334,6 +1334,13 @@ class Function_exp_integral(BuiltinFunction):
sage: Ei(-3 - 0.1*I)
-0.0129379427181693 - 3.13993830250942*I
The precision for the result is deduced from the precision of the
input. Convert the input to a higher precision explicitly if a
result with higher precision is desired::
sage: Ei(RealField(300)(1.1))
2.16737827956340282358378734233807621497112737591639704719499002090327541763352339357795426
ALGORITHM: Uses mpmath.
TESTS:
Expand Down Expand Up @@ -1412,33 +1419,6 @@ def _evalf_(self, x, parent=None, algorithm=None):
import mpmath
return mpmath_utils_call(mpmath.ei, x, parent=parent)

def __call__(self, x, prec=None, coerce=True, hold=False ):
"""
Note that the ``prec`` argument is deprecated. The precision for
the result is deduced from the precision of the input. Convert
the input to a higher precision explicitly if a result with higher
precision is desired.
EXAMPLES::
sage: t = Ei(RealField(100)(2.5)); t
7.0737658945786007119235519625
sage: t.prec()
100
sage: Ei(1.1, prec=300)
doctest:...: DeprecationWarning: The prec keyword argument is deprecated. Explicitly set the precision of the input, for example Ei(RealField(300)(1)), or use the prec argument to .n() for exact inputs, e.g., Ei(1).n(300), instead.
See http://trac.sagemath.org/7748 for details.
2.16737827956340306615064476647912607220394065907142504328679588538509331805598360907980986
"""
if prec is not None:
from sage.misc.superseded import deprecation
deprecation(7748, "The prec keyword argument is deprecated. Explicitly set the precision of the input, for example Ei(RealField(300)(1)), or use the prec argument to .n() for exact inputs, e.g., Ei(1).n(300), instead.")
import mpmath
return mpmath_utils_call(mpmath.ei, x, prec=prec)

return BuiltinFunction.__call__(self, x, coerce=coerce, hold=hold)

def _derivative_(self, x, diff_param=None):
"""
EXAMPLES::
Expand Down
49 changes: 11 additions & 38 deletions src/sage/functions/log.py
Expand Up @@ -64,6 +64,17 @@ def __init__(self):
sage: exp(7*pi*I/2)
-I
The precision for the result is deduced from the precision of
the input. Convert the input to a higher precision explicitly
if a result with higher precision is desired::
sage: t = exp(RealField(100)(2)); t
7.3890560989306502272304274606
sage: t.prec()
100
sage: exp(2).n(100)
7.3890560989306502272304274606
TEST::
sage: latex(exp(x))
Expand Down Expand Up @@ -110,44 +121,6 @@ def __init__(self):
GinacFunction.__init__(self, "exp", latex_name=r"\exp",
conversions=dict(maxima='exp'))

def __call__(self, x, coerce=True, hold=False, prec=None,
dont_call_method_on_arg=False):
"""
Note that the ``prec`` argument is deprecated. The precision for
the result is deduced from the precision of the input. Convert
the input to a higher precision explicitly if a result with higher
precision is desired.::
sage: t = exp(RealField(100)(2)); t
7.3890560989306502272304274606
sage: t.prec()
100
TESTS::
sage: exp(2,prec=100)
doctest:...: DeprecationWarning: The prec keyword argument is deprecated. Explicitly set the precision of the input, for example exp(RealField(300)(1)), or use the prec argument to .n() for exact inputs, e.g., exp(1).n(300), instead.
See http://trac.sagemath.org/7490 for details.
7.3890560989306502272304274606
Ensure that :trac:`13608` is fixed::
sage: import mpmath
sage: a = mpmath.mpf('0.5')
sage: exp(a)
mpf('1.6487212707001282')
sage: a.exp
-1
"""
if prec is not None:
from sage.misc.superseded import deprecation
deprecation(7490, "The prec keyword argument is deprecated. Explicitly set the precision of the input, for example exp(RealField(300)(1)), or use the prec argument to .n() for exact inputs, e.g., exp(1).n(300), instead.")
x = GinacFunction.__call__(self, x, coerce=coerce, hold=hold,
dont_call_method_on_arg=dont_call_method_on_arg)
return x.n(prec)
return GinacFunction.__call__(self, x, coerce=coerce, hold=hold,
dont_call_method_on_arg=dont_call_method_on_arg)

exp = Function_exp()

class Function_log(GinacFunction):
Expand Down
82 changes: 23 additions & 59 deletions src/sage/functions/other.py
Expand Up @@ -662,6 +662,8 @@ def __init__(self):
sage: gamma1(float(6)) # For ARM: rel tol 3e-16
120.0
sage: gamma(6.)
120.000000000000
sage: gamma1(x)
gamma(x)
Expand Down Expand Up @@ -742,62 +744,6 @@ def __init__(self):
ginac_name='tgamma',
conversions={'mathematica':'Gamma','maple':'GAMMA'})

def __call__(self, x, prec=None, coerce=True, hold=False):
"""
Note that the ``prec`` argument is deprecated. The precision for
the result is deduced from the precision of the input. Convert
the input to a higher precision explicitly if a result with higher
precision is desired.::
sage: t = gamma(RealField(100)(2.5)); t
1.3293403881791370204736256125
sage: t.prec()
100
sage: gamma(6, prec=53)
doctest:...: DeprecationWarning: The prec keyword argument is deprecated. Explicitly set the precision of the input, for example gamma(RealField(300)(1)), or use the prec argument to .n() for exact inputs, e.g., gamma(1).n(300), instead.
See http://trac.sagemath.org/7490 for details.
120.000000000000
TESTS::
sage: gamma(pi,prec=100)
2.2880377953400324179595889091
sage: gamma(3/4,prec=100)
1.2254167024651776451290983034
"""
if prec is not None:
from sage.misc.superseded import deprecation
deprecation(7490, "The prec keyword argument is deprecated. Explicitly set the precision of the input, for example gamma(RealField(300)(1)), or use the prec argument to .n() for exact inputs, e.g., gamma(1).n(300), instead.")
import mpmath
return mpmath_utils.call(mpmath.gamma, x, prec=prec)

# this is a kludge to keep
# sage: Q.<i> = NumberField(x^2+1)
# sage: gamma(i)
# working, since number field elements cannot be coerced into SR
# without specifying an explicit embedding into CC any more
try:
res = GinacFunction.__call__(self, x, coerce=coerce, hold=hold)
except TypeError as err:
# the __call__() method returns a TypeError for fast float arguments
# as well, we only proceed if the error message says that
# the arguments cannot be coerced to SR
if not str(err).startswith("cannot coerce"):
raise

from sage.misc.superseded import deprecation
deprecation(7490, "Calling symbolic functions with arguments that cannot be coerced into symbolic expressions is deprecated.")
parent = RR if prec is None else RealField(prec)
try:
x = parent(x)
except (ValueError, TypeError):
x = parent.complex_field()(x)
res = GinacFunction.__call__(self, x, coerce=coerce, hold=hold)

return res

gamma1 = Function_gamma()

class Function_log_gamma(GinacFunction):
Expand Down Expand Up @@ -1031,14 +977,32 @@ def gamma(a, *args, **kwds):
sage: gamma(CDF(I))
-0.15494982830181067 - 0.49801566811835607*I
The precision for the result is deduced from the precision of the
input. Convert the input to a higher precision explicitly if a result
with higher precision is desired.::
sage: t = gamma(RealField(100)(2.5)); t
1.3293403881791370204736256125
sage: t.prec()
100
sage: gamma(6)
120
sage: gamma(pi).n(100)
2.2880377953400324179595889091
sage: gamma(3/4).n(100)
1.2254167024651776451290983034
The gamma function only works with input that can be coerced to the
Symbolic Ring::
sage: Q.<i> = NumberField(x^2+1)
sage: gamma(i)
doctest:...: DeprecationWarning: Calling symbolic functions with arguments that cannot be coerced into symbolic expressions is deprecated.
See http://trac.sagemath.org/7490 for details.
-0.154949828301811 - 0.498015668118356*I
Traceback (most recent call last):
...
TypeError: cannot coerce arguments: no canonical coercion...
We make an exception for elements of AA or QQbar, which cannot be
coerced into symbolic expressions to allow this usage::
Expand Down
2 changes: 1 addition & 1 deletion src/sage/functions/trig.py
Expand Up @@ -945,7 +945,7 @@ def __init__(self):
ValueError: arctan2(0,0) undefined
Check if :trac:`10062` is fixed, this was caused by
``(I*I)._is_positive()`` returning ``True``::
``(I*I).is_positive()`` returning ``True``::
sage: arctan2(0, I*I)
pi
Expand Down
15 changes: 0 additions & 15 deletions src/sage/symbolic/expression.pyx
Expand Up @@ -1603,15 +1603,6 @@ cdef class Expression(CommutativeRingElement):
return self.operator().name()
return self._maxima_init_()


_is_real = deprecated_function_alias(10859, is_real)
_is_positive = deprecated_function_alias(10859, is_positive)
_is_negative = deprecated_function_alias(10859, is_negative)
_is_integer = deprecated_function_alias(10859, is_integer)
_is_symbol = deprecated_function_alias(10859, is_symbol)
_is_constant = deprecated_function_alias(10859, is_constant)
_is_numeric = deprecated_function_alias(10859, is_numeric)

def is_real(self):
"""
Return True if this expression is known to be a real number.
Expand Down Expand Up @@ -8282,7 +8273,6 @@ cdef class Expression(CommutativeRingElement):

trig_simplify = simplify_trig

@rename_keyword(deprecation=6094, method="algorithm")
def simplify_rational(self,algorithm='full', map=False):
r"""
Simplify rational expressions.
Expand Down Expand Up @@ -8538,7 +8528,6 @@ cdef class Expression(CommutativeRingElement):
radical_simplify = simplify_radical
simplify_exp = exp_simplify = simplify_radical

@rename_keyword(deprecation=6094, method="algorithm")
def simplify_log(self,algorithm=None):
r"""
Simplify symbolic expression, which can contain logs.
Expand Down Expand Up @@ -8696,7 +8685,6 @@ cdef class Expression(CommutativeRingElement):

log_simplify = simplify_log

@rename_keyword(deprecation=6094, method="algorithm")
def expand_log(self,algorithm='products'):
r"""
Simplify symbolic expression, which can contain logs.
Expand Down Expand Up @@ -9790,9 +9778,6 @@ cdef class Expression(CommutativeRingElement):
return find_local_minimum(self._fast_float_(var),
a=a, b=b, tol=tol, maxfun=maxfun )

find_maximum_on_interval = deprecated_function_alias(2607, find_local_maximum)
find_minimum_on_interval = deprecated_function_alias(2607, find_local_minimum)

###################
# Fast Evaluation #
###################
Expand Down

0 comments on commit 126311d

Please sign in to comment.