问题描述
我对 SymPy 当前的假设有一些疑问.查看这个线程.提示之一说使用假设模块(参考 此处).
I'm having some issues with SymPy's current assumptions.Look at this thread. One of the hints said to use the assume module (reference here).
我尝试进行以下计算 $\lim_{x \to \infty} \frac{\ln{x}}{x^k}$.我想评估 $k >0$ 的这个限制.
I tried doing the following computation $\lim_{x \to \infty} \frac{\ln{x}}{x^k}$. I want to evaluate this limit for $k >0$.
所以我尝试了这个:
with assuming(k>0):
limit((log(x))/(x**k),x,oo)
我也试过这个:
eval(limit((log(x))/(x**k),x,oo),k>0)
但无论如何,我收到此错误:
But regardless, I get this error:
NotImplementedError: Result depends on the sign of -sign(k)
在
with assume(k>0):
limit((log(x))/(x**k),x,oo)
我收到此错误:
TypeError: 'module' object is not callable
知道我做错了什么吗?
推荐答案
这似乎有效.您在 线程 中的第一个答案链接说SymPy 的假设系统现在有点混乱".我不确定从那以后是否发生了变化.
This seems to work. The first answer in the thread that you linked says that "The assumption system of SymPy is kind of a mess right now". I'm not sure if that has changed since then.
k = Symbol('k', positive=True)
print limit((log(x))/(x**k),x,oo)
这篇关于使用 SymPy 的新假设的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!