Skip to content

Commit fb12cbe

Browse files
Release Managervbraun
Release Manager
authored andcommittedFeb 6, 2016
Trac #19918: doctest fix for: substitute exp(-x) with x infinity fails
{{{ sage: exp(-Infinity) 0 }}} is fine, but {{{ sage: exp(-x).subs(x=Infinity) Traceback (most recent call last): ... RuntimeError: exp_eval(): exp^(unsigned_infinity) encountered }}} Original report thread: https://groups.google.com/forum/#!topic/sage-devel/tqDSbZ499ME URL: http://trac.sagemath.org/19918 Reported by: vdelecroix Ticket author(s): Benjamin Hackl Reviewer(s): Ralf Stephan
2 parents 25abdaf + 45420f5 commit fb12cbe

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
 

‎src/sage/functions/log.py

+7
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,13 @@ def __init__(self):
119119
120120
sage: 2*sqrt(e)
121121
2*sqrt(e)
122+
123+
Check that :trac:`19918` is fixed::
124+
125+
sage: exp(-x^2).subs(x=oo)
126+
0
127+
sage: exp(-x).subs(x=-oo)
128+
+Infinity
122129
"""
123130
GinacFunction.__init__(self, "exp", latex_name=r"\exp",
124131
conversions=dict(maxima='exp'))

‎src/sage/functions/trig.py

+7
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,13 @@ def __init__(self):
604604
605605
sage: arctan(x).operator()
606606
arctan
607+
608+
Check that :trac:`19918` is fixed::
609+
610+
sage: arctan(-x).subs(x=oo)
611+
-1/2*pi
612+
sage: arctan(-x).subs(x=-oo)
613+
1/2*pi
607614
"""
608615
GinacFunction.__init__(self, "arctan", latex_name=r'\arctan',
609616
conversions=dict(maxima='atan', sympy='atan'))

‎src/sage/symbolic/expression.pyx

+11
Original file line numberDiff line numberDiff line change
@@ -1532,6 +1532,17 @@ cdef class Expression(CommutativeRingElement):
15321532
... print "deriv: %s, hash:%s"%(deriv,h)
15331533
... else:
15341534
... hashes.add(n)
1535+
1536+
Check whether `oo` keeps its hash in `SR` (:trac:`19918`)::
1537+
1538+
sage: hash(oo) == hash(SR(oo))
1539+
True
1540+
sage: hash(oo) == hash((-x).subs(x=-oo))
1541+
True
1542+
sage: hash(-oo) == hash(SR(-oo))
1543+
True
1544+
sage: hash(-oo) == hash((-x).subs(x=oo))
1545+
True
15351546
"""
15361547
return self._gobj.gethash()
15371548

0 commit comments

Comments
 (0)