No Sympy two-sided limits?

a 夏天 提交于 2019-12-24 05:45:06

问题


I can't get Sympy to handle two-sided limits. Running in a Jupyter notebook, Anaconda installation:

from sympy import *
x = symbols('x')
limit(1/x,x,0)

gives an answer of oo. Furthermore,

Limit(1/x,x,0)

prints as a right-sided limit. In fact, all of my two-sided limits 'pretty-print' as right-sided limits. They seem to be evaluated that way, too. Can't find a way to force two-sided. Of course, one could write a short program to remedy this.

What am I doing wrong?


回答1:


limit has a fourth argument, dir, which specifies a direction:

>>> limit(1/x, x, 0, '+')
oo
>>> limit(1/x, x, 0, '-')
-oo
>>> limit(1/x, x, 0)
oo

The default is from the right. Bidirectional limits are not directly implemented yet, but you can easily check both directions.




回答2:


Two sided limits are now directly implemented.

>>> limit(1/x**2, x, 0, '+-')
oo


来源:https://stackoverflow.com/questions/39672198/no-sympy-two-sided-limits

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!