Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Problem evaluating limit: assume doesn't work!

Hi everyone,

I'm trying to evaluate the following limit in sage:

$$\lim_{N\to \infty}\frac{6N^k(N-1)^{1-k}}{(2N-1)(k+1)},$$

where $k\neq \pm1$. From Wolfram-Alpha I know this is equal to $3/(1+k)$, but I was trying to get to that answer with sage with no progress. What I did to do it was the following:

sage: N = var('N')
sage: k = var('k')
sage: assume(k!=1)
sage: assume(k!=-1)
sage: limit((6*N^k*(N-1)^(1-k))/((2*N-1)*(k+1)),N=oo)

But I get the following error:

ValueError                                Traceback (most recent call last)
<ipython-input-7-bb63a0377d1b> in <module>()
----> 1 limit((Integer(6)*N**k*(N-Integer(1))**(Integer(1)-k))/((Integer(2)*N-Integer(1))*(k+Integer(1))),N=oo)

/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/calculus/calculus.pyc in limit(ex, dir, taylor, algorithm, **argv)
   1198     if algorithm == 'maxima':
   1199         if dir is None:
-> 1200             l = maxima.sr_limit(ex, v, a)
   1201         elif dir in ['plus', '+', 'right', 'above']:
   1202             if dir == 'above':

/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.py in sr_limit(self, expr, v, a, dir)
    855                 j = s.find('Is ')
    856                 s = s[j:]
--> 857                 raise ValueError, "Computation failed since Maxima requested additional constraints; using the 'assume' command before limit evaluation *may* help (see `assume?` for more details)\n" + s
    858             else:
    859                 raise error

ValueError: Computation failed since Maxima requested additional constraints; using the 'assume' command before limit evaluation *may* help (see `assume?` for more details)
Is  k-1.0  positive or negative?

In general it doesn't matter if $k$ is positive or negative, they converge to the same value. However, for the sake of completeness, let's first try to restrict $k$ to values between 0 and 1. So, I opened other sage session and did:

sage: N = var('N')
sage: k = var('k')
sage: assume(k>0,k<1)
sage: limit((6*N^k*(N-1)^(1-k))/((2*N-1)*(k+1)),N=oo)

But I got:

ValueError                                Traceback (most recent call last)
<ipython-input-4-bb63a0377d1b> in <module>()
----> 1 limit((Integer(6)*N**k*(N-Integer(1))**(Integer(1)-k))/((Integer(2)*N-Integer(1))*(k+Integer(1))),N=oo)

/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/calculus/calculus.pyc in limit(ex, dir, taylor, algorithm, **argv)
   1198     if algorithm == 'maxima':
   1199         if dir is None:
-> 1200             l = maxima.sr_limit(ex, v, a)
   1201         elif dir in ['plus', '+', 'right', 'above']:
   1202             if dir == 'above':

/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.py in sr_limit(self, expr, v, a, dir)
    855                 j = s.find('Is ')
    856                 s = s[j:]
--> 857                 raise ValueError, "Computation failed since Maxima requested additional constraints; using the 'assume' command before limit evaluation *may* help (see `assume?` for more details)\n" + s
    858             else:
    859                 raise error

ValueError: Computation failed since Maxima requested additional constraints; using the 'assume' command before limit evaluation *may* help (see `assume?` for more details)
Is k an integer?

Trying to do sage: assume(k,'real') doesn't work, as I get the same error...how can I fix all this?

Thanks in advance!