Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 3072 by trato...@gmail.com: Limit of a piecewise function
http://code.google.com/p/sympy/issues/detail?id=3072

I get an error when trying to evaluate the limit of a piecewise function. The following code,

from sympy import *
x = symbols('x')
f1 = Piecewise((0, x<0), (1, True))
f1.limit(x, 0)

produces error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
File "C:\Python26\lib\site-packages\sympy\core\expr.py", line 1722, in limit
    return limit(self, x, xlim, dir)
File "C:\Python26\lib\site-packages\sympy\series\limits.py", line 192, in limit
    r = gruntz(e, z, z0, dir)
File "C:\Python26\lib\site-packages\sympy\series\gruntz.py", line 688, in gruntz
    r = limitinf(e0, z)
File "C:\Python26\lib\site-packages\sympy\core\cache.py", line 101, in wrapper
    func_cache_it_cache[k] = r = func(*args, **kw_args)
File "C:\Python26\lib\site-packages\sympy\series\gruntz.py", line 469, in limitinf
    e = e.rewrite('tractable', deep=True)
File "C:\Python26\lib\site-packages\sympy\core\basic.py", line 1186, in rewrite
    return self._eval_rewrite(None, rule, **hints)
File "C:\Python26\lib\site-packages\sympy\core\function.py", line 508, in _eval_rewrite
    args = [ a._eval_rewrite(pattern, rule, **hints) for a in self.args ]
File "C:\Python26\lib\site-packages\sympy\core\function.py", line 508, in _eval_rewrite
    args = [ a._eval_rewrite(pattern, rule, **hints) for a in self.args ]
AttributeError: 'bool' object has no attribute '_eval_rewrite'

This error also appears if direction is specified explicitly, i.e.

f1.limit(x, 0, '-')
f1.limit(x, 0, '+')

By the way, the Heaviside function from the special functions module works properly:

fH = functions.special.delta_functions.Heaviside(x)
fH.limit(x, 0, '+') # gives 1
fH.limit(x, 0, '-') # gives 0


With best regards, Anton Travleev.

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to