Status: New Owner: ---- Labels: Type-Defect Priority-Medium
New issue 2073 by goodrich.ben: limit() throws TypeError: an integer is required
http://code.google.com/p/sympy/issues/detail?id=2073 See http://groups.google.com/group/sympy/t/5df0421f2c4396e In [32]: c,n,r = symbols('cnr') In [33]: limit( (( 2*n*(n-r+1)/(n + r*(n-r+1)) )**c + (r-1)*( n*(n-r +2)/(n + r*(n-r+1)) )**c - n)/(n**c - n), n, oo ) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /tmp/<ipython console> in <module>() /usr/lib/pymodules/python2.6/sympy/series/limits.pyc in limit(e, z, z0, dir) 89 90 try: ---> 91 r = gruntz(e, z, z0, dir) 92 except PoleError: 93 r = heuristics(e, z, z0, dir) /usr/lib/pymodules/python2.6/sympy/series/gruntz.pyc in gruntz(e, z, z0, dir) 496 #convert all limits to the limit z->oo 497 elif z0 == oo: --> 498 return limitinf(e, z) 499 elif z0 == -oo: 500 return limitinf(e.subs(z,-z), z) /usr/lib/pymodules/python2.6/sympy/series/gruntz.pyc in limitinf(e, x) 337 if e.has(log): 338 e = e.normal() --> 339 c0, e0 = mrv_leadterm(e,x) 340 sig=sign(e0,x) 341 if sig==1: return S.Zero # e0>0: lim f = 0 /usr/lib/pymodules/python2.6/sympy/series/gruntz.pyc in mrv_leadterm(e, x, Omega) 395 e_up = moveup([e],x)[0] 396 #calculate the lead term --> 397 mrv_leadterm_up = mrv_leadterm(e_up, x, Omega_up) 398 #move the result (c0, e0) down 399 return tuple(movedown(mrv_leadterm_up, x)) /usr/lib/pymodules/python2.6/sympy/series/gruntz.pyc in mrv_leadterm(e, x, Omega) 404 wsym = Symbol("w", real=True, positive=True, dummy=True) 405 f, logw=rewrite(e, set(Omega), x, wsym) --> 406 series = calculate_series(f, wsym) 407 series=series.subs(log(wsym), logw) 408 return series.leadterm(wsym) /usr/lib/pymodules/python2.6/sympy/series/gruntz.pyc in calculate_series(e, x) 370 371 f = e --> 372 series=f.nseries(x, 0, 2).removeO() 373 if series == 0: 374 #we need to calculate more terms, let's try 4: /usr/lib/pymodules/python2.6/sympy/core/basic.pyc in nseries(self, x, x0, n) 2253 See also lseries(). 2254 """ -> 2255 return self._eval_nseries(x, x0, n) 2256 2257 def _eval_nseries(self, x, x0, n): /usr/lib/pymodules/python2.6/sympy/core/mul.pyc in _eval_nseries(self, x, x0, n) 934 def _eval_nseries(self, x, x0, n): 935 from sympy import powsimp --> 936 terms = [t.nseries(x, x0, n) for t in self.args] 937 return powsimp(Mul(*terms).expand(), combine='exp', deep=True) 938 /usr/lib/pymodules/python2.6/sympy/core/basic.pyc in nseries(self, x, x0, n) 2253 See also lseries(). 2254 """ -> 2255 return self._eval_nseries(x, x0, n) 2256 2257 def _eval_nseries(self, x, x0, n): /usr/lib/pymodules/python2.6/sympy/core/add.pyc in _eval_nseries(self, x, x0, n) 178 179 def _eval_nseries(self, x, x0, n): --> 180 terms = [t.nseries(x, x0, n) for t in self.args] 181 return Add(*terms) 182 /usr/lib/pymodules/python2.6/sympy/core/basic.pyc in nseries(self, x, x0, n) 2253 See also lseries(). 2254 """ -> 2255 return self._eval_nseries(x, x0, n) 2256 2257 def _eval_nseries(self, x, x0, n): /usr/lib/pymodules/python2.6/sympy/core/mul.pyc in _eval_nseries(self, x, x0, n) 934 def _eval_nseries(self, x, x0, n): 935 from sympy import powsimp --> 936 terms = [t.nseries(x, x0, n) for t in self.args] 937 return powsimp(Mul(*terms).expand(), combine='exp', deep=True) 938 /usr/lib/pymodules/python2.6/sympy/core/basic.pyc in nseries(self, x, x0, n) 2253 See also lseries(). 2254 """ -> 2255 return self._eval_nseries(x, x0, n) 2256 2257 def _eval_nseries(self, x, x0, n): /usr/lib/pymodules/python2.6/sympy/core/power.pyc in _eval_nseries(self, x, x0, n) 700 lt = b.as_leading_term(x) 701 o = order * lt**(1-e) --> 702 bs = b.nseries(x, x0, n-e) 703 if bs.is_Add: 704 bs = bs.removeO() /usr/lib/pymodules/python2.6/sympy/core/basic.pyc in nseries(self, x, x0, n) 2253 See also lseries(). 2254 """ -> 2255 return self._eval_nseries(x, x0, n) 2256 2257 def _eval_nseries(self, x, x0, n): /usr/lib/pymodules/python2.6/sympy/core/mul.pyc in _eval_nseries(self, x, x0, n) 934 def _eval_nseries(self, x, x0, n): 935 from sympy import powsimp --> 936 terms = [t.nseries(x, x0, n) for t in self.args] 937 return powsimp(Mul(*terms).expand(), combine='exp', deep=True) 938 /usr/lib/pymodules/python2.6/sympy/core/basic.pyc in nseries(self, x, x0, n) 2253 See also lseries(). 2254 """ -> 2255 return self._eval_nseries(x, x0, n) 2256 2257 def _eval_nseries(self, x, x0, n): /usr/lib/pymodules/python2.6/sympy/core/power.pyc in _eval_nseries(self, x, x0, n) 656 from sympy.functions import ceiling 657 terms = [1/prefactor] --> 658 for m in xrange(1,ceiling(n/l)): 659 new_term = terms[-1]*(-rest) 660 if new_term.is_Pow: TypeError: an integer is required -- You received this message because you are subscribed to the Google Groups "sympy-issues" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy-issues?hl=en.
