1

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).

I tried doing the following computation $\lim_{x \to \infty} \frac{\ln{x}}{x^k}$. I want to evaluate this limit for $k >0$.

So I tried this:

 with assuming(k>0):
     limit((log(x))/(x**k),x,oo)

I also tried this:

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)

In the case of

with assume(k>0):
    limit((log(x))/(x**k),x,oo)

I get this error:

TypeError: 'module' object is not callable

Any ideas what I'm doing wrong?

Community
  • 1
  • 1
  • `eval` is a Python builtin. It would never do what you are expecting here. The function that might work is `refine` (it doesn't now, but it will eventually). – asmeurer Apr 05 '14 at 05:55

1 Answers1

1

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)
Community
  • 1
  • 1
ysakamoto
  • 2,512
  • 1
  • 16
  • 22
  • 2
    There are currently two assumptions systems. This uses the old assumptions system which is more robust and therefore in common use. We hope to roll out new assumptions before the 1.0 release. – MRocklin Apr 04 '14 at 21:15
  • It is still a mess in the sense that the new assumptions (`assuming`, `ask`, `Q`, `refine`) are not used anywhere, which is why this doesn't work. Well, that and it doesn't recognize inequalities yet. You would have to use `Q.positive(k)` instead of `k > 0`. – asmeurer Apr 05 '14 at 05:56