# limit involving multi-arg function (polygamma) fails #5415

Open
opened this Issue Apr 27, 2011 · 6 comments

Projects
None yet
7 participants
Member

### smichr commented Apr 27, 2011

 h[2] >>> polygamma(2,3) polygamma(2, 3) h[3] >>> _.n() -0.154113806319189 h[4] >>> limit(polygamma(2+1/x,3+exp(-x)),x,oo) Traceback (most recent call last): File "", line 1, in File "sympy\series\limits.py", line 186, in limit r = gruntz(e, z, z0, dir) File "sympy\series\gruntz.py", line 473, in gruntz return limitinf(e, z) File "sympy\series\gruntz.py", line 340, in limitinf return limitinf(c0, x) #e0=0: lim f = lim c0 File "sympy\series\gruntz.py", line 328, in limitinf c0, e0 = mrv_leadterm(e, x) File "sympy\series\gruntz.py", line 390, in mrv_leadterm mrv_leadterm_up = mrv_leadterm(e_up, x, Omega_up) File "sympy\series\gruntz.py", line 402, in mrv_leadterm series = calculate_series(f, w) File "sympy\series\gruntz.py", line 364, in calculate_series series = f.nseries(x, n=n).removeO() File "sympy\core\expr.py", line 1394, in nseries return self._eval_nseries(x, n=n) File "sympy\core\function.py", line 315, in _eval_nseries e = e.diff(x) File "sympy\core\expr.py", line 1499, in diff return Derivative(self, *new_symbols, **assumptions) File "sympy\core\function.py", line 601, in __new__ obj = expr._eval_derivative(s) File "sympy\core\function.py", line 266, in _eval_derivative df = self.fdiff(i) File "sympy\functions\special\gamma_functions.py", line 156, in fdiff raise ArgumentIndexError(self, argindex) NameError: global name 'ArgumentIndexError' is not defined  Original issue for #5415: http://code.google.com/p/sympy/issues/detail?id=2316 Original author: https://code.google.com/u/117933771799683895267/ Original owner: https://code.google.com/u/117933771799683895267/
Member

### smichr commented Apr 27, 2011

 **Summary:** limit involving multi-arg function (polygamma) fails  Original comment: http://code.google.com/p/sympy/issues/detail?id=2316#c1 Original author: https://code.google.com/u/117933771799683895267/
Member

### rlamy commented Apr 27, 2011

 The first argument of polygamma has to be an integer, so the limit is meaningless. The error message could be nicer though. The problem with ArgumentIndexError is issue 4853 .  Referenced issues: #4853 Original comment: http://code.google.com/p/sympy/issues/detail?id=2316#c2 Original author: https://code.google.com/u/101272611947379421629/
Member

### asmeurer commented Mar 20, 2012

 **Status:** Valid  Original comment: http://code.google.com/p/sympy/issues/detail?id=2316#c3 Original author: https://code.google.com/u/asmeurer@gmail.com/
Contributor

### skirpichev commented Aug 3, 2013

 Now the error is "NotImplementedError: MRV set computation for functions in several variables not implemented." Looks better, I think. **Labels:** Series  Original comment: http://code.google.com/p/sympy/issues/detail?id=2316#c4 Original author: https://code.google.com/u/113518207426301808764/
Contributor

### hacman commented Dec 8, 2013

 I'm wondering what is involved in fixing this. I got a similar error ("NotImplementedError: MRV set ...") when trying to evaluate >>> num = binomial(2*n,n)/(n+1) >>> denom = 4**n/sqrt(pi*n**3) >>> limit(num/denom, n, oo) If I tell sympy to use the factorial definition of the binomial coefficient, I get the right answer: >> num = factorial(2*n)/factorial(n)**2/(n+1) >>> denom = 4**n/sqrt(pi*n**3) >>> limit(num/denom, n, oo) 1 What's slightly special about this case is that the error relating to several variables does not really apply. Since I am evaluating a quantity that, while defined in terms of a binomial coefficient, is really a univariate expression. So my questions are twofold: 1. what is involved in getting full multivariate support? 2. if that is too difficult, is it worth attempting to simplify expressions that are actually univariate? I believe that .free_symbols would work here)  Original comment: http://code.google.com/p/sympy/issues/detail?id=2316#c5 Original author: https://code.google.com/u/111461499536629158271/

Contributor

### pelegm commented Nov 17, 2014

 The following looks like the same issue: >>> n = Symbol('n', integer=True, positive=True) >>> limit(binomial(n, n/2), n, oo) raises Traceback (most recent call last): File "", line 1, in limit(binomial(n, n/2), n, oo) File "sympy/series/limits.py", line 42, in limit return Limit(e, z, z0, dir).doit(deep=False) File "sympy/series/limits.py", line 157, in doit r = gruntz(e, z, z0, dir) File "sympy/series/gruntz.py", line 641, in gruntz r = limitinf(e, z) File "sympy/core/cache.py", line 91, in wrapper retval = cfunc(*args, **kwargs) File "sympy/core/compatibility.py", line 872, in wrapper result = user_function(*args, **kwds) File "sympy/series/gruntz.py", line 424, in limitinf c0, e0 = mrv_leadterm(e, x) File "sympy/core/cache.py", line 91, in wrapper retval = cfunc(*args, **kwargs) File "sympy/core/compatibility.py", line 872, in wrapper result = user_function(*args, **kwds) File "sympy/series/gruntz.py", line 480, in mrv_leadterm Omega, exps = mrv(e, x) File "sympy/series/gruntz.py", line 295, in mrv raise NotImplementedError("MRV set computation for functions in" NotImplementedError: MRV set computation for functions in several variables not implemented.

Open

### skirpichev added a commit to skirpichev/diofant that referenced this issue Nov 2, 2016

 Add regression tests & mention closed issues 
    close sympy/sympy#3112 (MrvAsympt was added in diofant#6)
close sympy/sympy#9173 (test was added in 5a510ac)
close sympy/sympy#9808 (fixed in 09e539b)
close sympy/sympy#9341 (fixed in af98a00)
close sympy/sympy#9908 (fixed in cc3fa8d)
close sympy/sympy#6171 (test added in d278031)
close sympy/sympy#9276 (diagnose_imports.py removed in ab8c535)
close sympy/sympy#10201 (fixed in 0d0fc5f)
close sympy/sympy#9057 (test was added in 8290a0c)
close sympy/sympy#11159 (test was added in ffb76cb)
close sympy/sympy#2839 (new AST transformers are used, see diofant#278 and diofant#167)
close sympy/sympy#11081 (see ed01e16 and bb92329)
close sympy/sympy#10974 (see 73fc425)
close sympy/sympy#10806 (test in 539929a)
close sympy/sympy#10801 (test in 2fe3da5)
close sympy/sympy#9549 (test in 88bdefa)
close sympy/sympy#4231 (test was added in fb411d5)
close sympy/sympy#8634 (see 2fcbb58)
close sympy/sympy#8481 (see 1ef20d3)
close sympy/sympy#9956 (fixed in a34735f)
close sympy/sympy#9747 (see e117c60)
close sympy/sympy#7853 (see 3e4fbed)
close sympy/sympy#9634 (see 2be03f5)
close sympy/sympy#8500 (fixed in diofant#104 and finally in diofant#316)
close sympy/sympy#9192 (see 9bf622f)
close sympy/sympy#7130 (see e068fa3)
close sympy/sympy#8514 (see b2d543b)
close sympy/sympy#9334 (see 90de625)
close sympy/sympy#8229 (see 9755b89)
close sympy/sympy#8061 (see 7054f06)
close sympy/sympy#7872 (tested in diofant#6)
close sympy/sympy#3496 (tested in test_log_symbolic)
close sympy/sympy#2929 (see da7db7a)
close sympy/sympy#8203 (oo is not a real, see diofant#36)
close sympy/sympy#7649 (0 is imaginary since diofant#8)
close sympy/sympy#7256 (fixed in c0a4549)
close sympy/sympy#6783 (see cb28d63)
close sympy/sympy#5662 (is_integer issue fixed in 6bfa9f8, there is no is_bounded anymore)
close sympy/sympy#5295 (fixed with diofant#354)
close sympy/sympy#4856 (we now have flake/pep tests)
close sympy/sympy#4555 (flake8 enabled after diofant#214)
close sympy/sympy#5773 (cmp_to_key removed after diofant#164 and c9acbf0)
close sympy/sympy#5484 (see above)

fixes sympy/sympy#8825 (probably via diofant#209)
fixes sympy/sympy#8635
fixes sympy/sympy#8157
fixes sympy/sympy#7872
fixes sympy/sympy#7599
fixes sympy/sympy#6179
fixes sympy/sympy#5415
fixes sympy/sympy#2865
fixes sympy/sympy#5907
fixes sympy/sympy#11722

Closes diofant#347
 74ade76 

### skirpichev added a commit to skirpichev/diofant that referenced this issue Nov 2, 2016

 Add regression tests & mention closed issues 
    close sympy/sympy#3112 (MrvAsympt was added in diofant#6)
close sympy/sympy#9173 (test was added in 5a510ac)
close sympy/sympy#9808 (fixed in 09e539b)
close sympy/sympy#9341 (fixed in af98a00)
close sympy/sympy#9908 (fixed in cc3fa8d)
close sympy/sympy#6171 (test added in d278031)
close sympy/sympy#9276 (diagnose_imports.py removed in ab8c535)
close sympy/sympy#10201 (fixed in 0d0fc5f)
close sympy/sympy#9057 (test was added in 8290a0c)
close sympy/sympy#11159 (test was added in ffb76cb)
close sympy/sympy#2839 (new AST transformers are used, see diofant#278 and diofant#167)
close sympy/sympy#11081 (see ed01e16 and bb92329)
close sympy/sympy#10974 (see 73fc425)
close sympy/sympy#10806 (test in 539929a)
close sympy/sympy#10801 (test in 2fe3da5)
close sympy/sympy#9549 (test in 88bdefa)
close sympy/sympy#4231 (test was added in fb411d5)
close sympy/sympy#8634 (see 2fcbb58)
close sympy/sympy#8481 (see 1ef20d3)
close sympy/sympy#9956 (fixed in a34735f)
close sympy/sympy#9747 (see e117c60)
close sympy/sympy#7853 (see 3e4fbed)
close sympy/sympy#9634 (see 2be03f5)
close sympy/sympy#8500 (fixed in diofant#104 and finally in diofant#316)
close sympy/sympy#9192 (see 9bf622f)
close sympy/sympy#7130 (see e068fa3)
close sympy/sympy#8514 (see b2d543b)
close sympy/sympy#9334 (see 90de625)
close sympy/sympy#8229 (see 9755b89)
close sympy/sympy#8061 (see 7054f06)
close sympy/sympy#7872 (tested in diofant#6)
close sympy/sympy#3496 (tested in test_log_symbolic)
close sympy/sympy#2929 (see da7db7a)
close sympy/sympy#8203 (oo is not a real, see diofant#36)
close sympy/sympy#7649 (0 is imaginary since diofant#8)
close sympy/sympy#7256 (fixed in c0a4549)
close sympy/sympy#6783 (see cb28d63)
close sympy/sympy#5662 (is_integer issue fixed in 6bfa9f8, there is no is_bounded anymore)
close sympy/sympy#5295 (fixed with diofant#354)
close sympy/sympy#4856 (we now have flake/pep tests)
close sympy/sympy#4555 (flake8 enabled after diofant#214)
close sympy/sympy#5773 (cmp_to_key removed after diofant#164 and c9acbf0)
close sympy/sympy#5484 (see above)

fixes sympy/sympy#8825 (probably via diofant#209)
fixes sympy/sympy#8635
fixes sympy/sympy#8157
fixes sympy/sympy#7872
fixes sympy/sympy#7599
fixes sympy/sympy#6179
fixes sympy/sympy#5415
fixes sympy/sympy#2865
fixes sympy/sympy#5907
fixes sympy/sympy#11722

Closes diofant#347
 48c035e