bug in calculus.limit reported in ask.sagemath

33 views
Skip to first unread message

David....@inria.fr

unread,
May 22, 2017, 3:08:28 AM5/22/17
to sage-devel
reported in https://ask.sagemath.org/question/37660/why-is-sage-calling-1-a-variable/

===================
sage: x = var('x')
sage: f = 1/(x-3)
sage: limit(f,x=3,dir='below')
---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
<ipython-input-9-bb86812b786f> in <module>()
----> 1 limit(f,x=Integer(3),dir='below')

/Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/calculus/calculus.pyc in limit(ex, dir, taylor, algorithm, **argv)
   1349
   1350     #return l.sage()
-> 1351     return ex.parent()(l)
   1352
   1353 # lim is alias for limit

UnboundLocalError: local variable 'l' referenced before assignment
===================

A quick look at the method shows that local variable `l` (small cap `L) used in the method is not assigned when `algorithm=maxima` and `dir='below'`.
The case `dir='below'` is possible when `algorithm == 'maxima_taylor'` but is not specified in the INPUT section.
Some clarification is needed.
Reply all
Reply to author
Forward
0 new messages