# Revision history [back]

### Simplifying factorials, limits, Maxima crash

I am trying to simplify some binomial expressions using Sage.

var('a,n,c,m')
H = binomial(2*m-c,m-c)-binomial(2*m-c,m+1)
Cn = binomial(2*n,n)/(n+1)
Uan = (H.substitute(m=n,c=a+1) + a*H.substitute(m=n-n,c=a))/Cn
assume(a>0)
assume(n>0)
assume(n,'integer')
assume(a,'integer')
UUan=Uan.full_simplify()
UUan


Now I want the limit of this expression as n -> +Infininty. Maple can do it, it correctly returns (a^2 + 3a)2^(-a - 1) + 2^(1 - a)

I can get Sage to calculate the limit for specific values of a:

limit(UUan.substitute(a=5),n=+Infinity)


However, when I try

limit(UUan,n=+Infinity)


I get an error from the underlying Maxima engine:

RuntimeError Traceback (most recent call last) <ipython-input-70-59aa81a6cc92> in <module> ----> 1 limit(UUan,n=+Infinity)

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/calculus/calculus.py in limit(ex, dir, taylor, algorithm, **argv) 1415 if algorithm == 'maxima': 1416 if dir is None: -> 1417 l = maxima.sr_limit(ex, v, a) 1418 elif dir in dir_plus: 1419 l = maxima.sr_limit(ex, v, a, 'plus')

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/interfaces/maxima_lib.py in sr_limit(self, expr, v, a, dir) 985 elif dir == "minus": 986 L.append(max_minus) --> 987 return max_to_sr(maxima_eval(([max_limit], L))) 988 except RuntimeError as error: 989 s = str(error)

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.EclObject.__call__ (build/cythonized/sage/libs/ecl.c:8511)() 836 """ 837 lispargs = EclObject(list(args)) --> 838 return ecl_wrap(ecl_safe_apply(self.obj,(<eclobject>lispargs).obj)) 839 840 def __richcmp__(left, right, int op):

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.ecl_safe_apply (build/cythonized/sage/libs/ecl.c:6053)() 357 raise KeyboardInterrupt("ECL says: {}".format(message)) 358 else: --> 359 raise RuntimeError("ECL says: {}".format(message)) 360 else: 361 return ret

RuntimeError: ECL says: BINDING-STACK overflow at size 10240. Stack can probably be resized. Proceed with caution.

Is SAGE able to compute this limit? Should i provide other provisos? Is there another approach I should try?

### Simplifying factorials, limits, Maxima crash

I am trying to simplify some binomial expressions using Sage.

var('a,n,c,m')
H = binomial(2*m-c,m-c)-binomial(2*m-c,m+1)
Cn = binomial(2*n,n)/(n+1)
Uan = (H.substitute(m=n,c=a+1) + a*H.substitute(m=n-n,c=a))/Cn
assume(a>0)
assume(n>0)
assume(n,'integer')
assume(a,'integer')
UUan=Uan.full_simplify()
UUan


Now I want the limit of this expression as n -> +Infininty. Maple can do it, it correctly returns (a^2

                                                             2                  (-a)
(a  + 3a)2^(-a - 1) 3 a + 2^(1 - a)4) 2
--------------------
4


I can get Sage to calculate the limit for specific values of a:

limit(UUan.substitute(a=5),n=+Infinity)


However, when I try

limit(UUan,n=+Infinity)


I get an error from the underlying Maxima engine:

RuntimeError Traceback (most recent call last) <ipython-input-70-59aa81a6cc92> in <module> ----> 1 limit(UUan,n=+Infinity)

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/calculus/calculus.py in limit(ex, dir, taylor, algorithm, **argv) 1415 if algorithm == 'maxima': 1416 if dir is None: -> 1417 l = maxima.sr_limit(ex, v, a) 1418 elif dir in dir_plus: 1419 l = maxima.sr_limit(ex, v, a, 'plus')

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/interfaces/maxima_lib.py in sr_limit(self, expr, v, a, dir) 985 elif dir == "minus": 986 L.append(max_minus) --> 987 return max_to_sr(maxima_eval(([max_limit], L))) 988 except RuntimeError as error: 989 s = str(error)

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.EclObject.__call__ (build/cythonized/sage/libs/ecl.c:8511)() 836 """ 837 lispargs = EclObject(list(args)) --> 838 return ecl_wrap(ecl_safe_apply(self.obj,(<eclobject>lispargs).obj)) 839 840 def __richcmp__(left, right, int op):

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.ecl_safe_apply (build/cythonized/sage/libs/ecl.c:6053)() 357 raise KeyboardInterrupt("ECL says: {}".format(message)) 358 else: --> 359 raise RuntimeError("ECL says: {}".format(message)) 360 else: 361 return ret

RuntimeError: ECL says: BINDING-STACK overflow at size 10240. Stack can probably be resized. Proceed with caution.

Is SAGE able to compute this limit? Should i provide other provisos? Is there another approach I should try?

### Simplifying factorials, limits, Maxima crash

I am trying to simplify some binomial expressions using Sage.

var('a,n,c,m')
H = binomial(2*m-c,m-c)-binomial(2*m-c,m+1)
Cn = binomial(2*n,n)/(n+1)
Uan = (H.substitute(m=n,c=a+1) + a*H.substitute(m=n-n,c=a))/Cn
assume(a>0)
assume(n>0)
assume(n,'integer')
assume(a,'integer')
UUan=Uan.full_simplify()
UUan


Now I want the limit of this expression as n -> +Infininty. Maple can do it, it correctly returns

                                                             2                  (-a)
(a  + 3 a + 4) 2
--------------------
4


I can get Sage to calculate the limit for specific values of a:

limit(UUan.substitute(a=5),n=+Infinity)


However, when I try

limit(UUan,n=+Infinity)


I get an error from the underlying Maxima engine:

RuntimeError Traceback (most recent call last) <ipython-input-70-59aa81a6cc92> in <module> ----> 1 limit(UUan,n=+Infinity)

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/calculus/calculus.py in limit(ex, dir, taylor, algorithm, **argv) 1415 if algorithm == 'maxima': 1416 if dir is None: -> 1417 l = maxima.sr_limit(ex, v, a) 1418 elif dir in dir_plus: 1419 l = maxima.sr_limit(ex, v, a, 'plus')

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/interfaces/maxima_lib.py in sr_limit(self, expr, v, a, dir) 985 elif dir == "minus": 986 L.append(max_minus) --> 987 return max_to_sr(maxima_eval(([max_limit], L))) 988 except RuntimeError as error: 989 s = str(error)

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.EclObject.__call__ (build/cythonized/sage/libs/ecl.c:8511)() 836 """ 837 lispargs = EclObject(list(args)) --> 838 return ecl_wrap(ecl_safe_apply(self.obj,(<eclobject>lispargs).obj)) 839 840 def __richcmp__(left, right, int op):

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.ecl_safe_apply (build/cythonized/sage/libs/ecl.c:6053)() 357 raise KeyboardInterrupt("ECL says: {}".format(message)) 358 else: --> 359 raise RuntimeError("ECL says: {}".format(message)) 360 else: 361 return ret

RuntimeError: ECL says: BINDING-STACK overflow at size 10240. Stack can probably be resized. Proceed with caution.

Is SAGE able to compute this limit? Should i provide other provisos? Is there another approach I should try?

### Simplifying factorials, limits, Maxima crash

I am trying to simplify some binomial expressions using Sage.

var('a,n,c,m')
H = binomial(2*m-c,m-c)-binomial(2*m-c,m+1)
Cn = binomial(2*n,n)/(n+1)
Uan = (H.substitute(m=n,c=a+1) + a*H.substitute(m=n-n,c=a))/Cn a*H.substitute(m=n-1,c=a))/Cn
assume(a>0)
assume(n>0)
assume(n,'integer')
assume(a,'integer')
UUan=Uan.full_simplify()
UUan


Now I want the limit of this expression as n -> +Infininty. Maple can do it, it correctly returns

                                                             2                  (-a)
(a  + 3 a + 4) 2
--------------------
4


I can get Sage to calculate the limit for specific values of a:

limit(UUan.substitute(a=5),n=+Infinity)


However, when I try

limit(UUan,n=+Infinity)


I get an error from the underlying Maxima engine:

RuntimeError Traceback (most recent call last) <ipython-input-70-59aa81a6cc92> in <module> ----> 1 limit(UUan,n=+Infinity)

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/calculus/calculus.py in limit(ex, dir, taylor, algorithm, **argv) 1415 if algorithm == 'maxima': 1416 if dir is None: -> 1417 l = maxima.sr_limit(ex, v, a) 1418 elif dir in dir_plus: 1419 l = maxima.sr_limit(ex, v, a, 'plus')

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/interfaces/maxima_lib.py in sr_limit(self, expr, v, a, dir) 985 elif dir == "minus": 986 L.append(max_minus) --> 987 return max_to_sr(maxima_eval(([max_limit], L))) 988 except RuntimeError as error: 989 s = str(error)

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.EclObject.__call__ (build/cythonized/sage/libs/ecl.c:8511)() 836 """ 837 lispargs = EclObject(list(args)) --> 838 return ecl_wrap(ecl_safe_apply(self.obj,(<eclobject>lispargs).obj)) 839 840 def __richcmp__(left, right, int op):

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.ecl_safe_apply (build/cythonized/sage/libs/ecl.c:6053)() 357 raise KeyboardInterrupt("ECL says: {}".format(message)) 358 else: --> 359 raise RuntimeError("ECL says: {}".format(message)) 360 else: 361 return ret

RuntimeError: ECL says: BINDING-STACK overflow at size 10240. Stack can probably be resized. Proceed with caution.

Is SAGE able to compute this limit? Should i provide other provisos? Is there another approach I should try?

### Simplifying factorials, limits, Maxima crash

I am trying to simplify some binomial expressions using Sage.

var('a,n,c,m')
H = binomial(2*m-c,m-c)-binomial(2*m-c,m+1)
Cn = binomial(2*n,n)/(n+1)
Uan = (H.substitute(m=n,c=a+1) + a*H.substitute(m=n-1,c=a))/Cn
assume(a>0)
assume(n>0)
assume(n,'integer')
assume(a,'integer')
UUan=Uan.full_simplify()
UUan


Now I want the limit of this expression as n -> +Infininty. Maple can do it, it correctly returns

                                                             2                  (-a)
(a  + 3 a + 4) 2
--------------------
4


I can get Sage to calculate the limit for specific values of a:

limit(UUan.substitute(a=5),n=+Infinity)


However, when I try

limit(UUan,n=+Infinity)


I get an error from the underlying Maxima engine:

RuntimeError Traceback (most recent call last) <ipython-input-70-59aa81a6cc92> in <module> ----> 1 limit(UUan,n=+Infinity)

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/calculus/calculus.py in limit(ex, dir, taylor, algorithm, **argv) 1415 if algorithm == 'maxima': 1416 if dir is None: -> 1417 l = maxima.sr_limit(ex, v, a) 1418 elif dir in dir_plus: 1419 l = maxima.sr_limit(ex, v, a, 'plus')

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/interfaces/maxima_lib.py in sr_limit(self, expr, v, a, dir) 985 elif dir == "minus": 986 L.append(max_minus) --> 987 return max_to_sr(maxima_eval(([max_limit], L))) 988 except RuntimeError as error: 989 s = str(error)

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.EclObject.__call__ (build/cythonized/sage/libs/ecl.c:8511)() 836 """ 837 lispargs = EclObject(list(args)) --> 838 return ecl_wrap(ecl_safe_apply(self.obj,(<eclobject>lispargs).obj)) 839 840 def __richcmp__(left, right, int op):

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.ecl_safe_apply (build/cythonized/sage/libs/ecl.c:6053)() 357 raise KeyboardInterrupt("ECL says: {}".format(message)) 358 else: --> 359 raise RuntimeError("ECL says: {}".format(message)) 360 else: 361 return ret

RuntimeError: ECL says: BINDING-STACK overflow at size 10240. Stack can probably be resized. Proceed with caution.

Is SAGE able to compute this limit? Should i provide other provisos? Is there another approach I should try?

 6 None Max Alekseyev 6167 ●7 ●40 ●135

### Simplifying factorials, limits, Maxima crash

I am trying to simplify some binomial expressions using Sage.

var('a,n,c,m')
H = binomial(2*m-c,m-c)-binomial(2*m-c,m+1)
Cn = binomial(2*n,n)/(n+1)
Uan = (H.substitute(m=n,c=a+1) + a*H.substitute(m=n-1,c=a))/Cn
assume(a>0)
assume(n>0)
assume(n,'integer')
assume(a,'integer')
UUan=Uan.full_simplify()
UUan


Now I want the limit of this expression as n -> +Infininty. Maple can do it, it correctly returns

                                                             2                  (-a)
(a  + 3 a + 4) 2
--------------------
4


I can get Sage to calculate the limit for specific values of a:

limit(UUan.substitute(a=5),n=+Infinity)


However, when I try

limit(UUan,n=+Infinity)


I get an error from the underlying Maxima engine:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-70-59aa81a6cc92> in <module>
----> 1 limit(UUan,n=+Infinity) limit(UUan,n=+Infinity)

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/calculus/calculus.py in limit(ex, dir, taylor, algorithm, **argv)
1415     if algorithm == 'maxima':
1416         if dir is None:
-> 1417             l = maxima.sr_limit(ex, v, a)
1418         elif dir in dir_plus:
1419             l = maxima.sr_limit(ex, v, a, 'plus') 'plus')

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/interfaces/maxima_lib.py in sr_limit(self, expr, v, a, dir)
985             elif dir == "minus":
986                 L.append(max_minus)
--> 987             return max_to_sr(maxima_eval(([max_limit], L)))
988         except RuntimeError as error:
989             s = str(error) str(error)

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.EclObject.__call__ (build/cythonized/sage/libs/ecl.c:8511)()
836         """
837         lispargs = EclObject(list(args))
--> 838         return ecl_wrap(ecl_safe_apply(self.obj,(<eclobject>lispargs).obj))
ecl_wrap(ecl_safe_apply(self.obj,(<EclObject>lispargs).obj))
839
840     def __richcmp__(left, right, int op): op):

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.ecl_safe_apply (build/cythonized/sage/libs/ecl.c:6053)()
357             raise KeyboardInterrupt("ECL says: {}".format(message))
358         else:
--> 359             raise RuntimeError("ECL says: {}".format(message))
360     else:
361         return ret ret

RuntimeError: ECL says: BINDING-STACK overflow at size 10240. Stack can probably be resized.
Proceed with caution. caution.

---------------------------------------------------------------------------------------------------------------------------------------------


Is SAGE able to compute this limit? Should i provide other provisos? Is there another approach I should try?

### Simplifying factorials, limits, Maxima crash

I am trying to simplify some binomial expressions using Sage.

var('a,n,c,m')
H = binomial(2*m-c,m-c)-binomial(2*m-c,m+1)
Cn = binomial(2*n,n)/(n+1)
Uan = (H.substitute(m=n,c=a+1) + a*H.substitute(m=n-1,c=a))/Cn
assume(a>0)
assume(n>0)
assume(n,'integer')
assume(a,'integer')
UUan=Uan.full_simplify()
UUan


Now I want the limit of this expression as n -> +Infininty. Maple can do it, it correctly returns

                                                             2                  (-a)
(a  + 3 a + 4) 2
--------------------
4


I can get Sage to calculate the limit for specific values of a:

limit(UUan.substitute(a=5),n=+Infinity)


However, when I try

limit(UUan,n=+Infinity)


I get an error from the underlying Maxima engine:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-70-59aa81a6cc92> in <module>
----> 1 limit(UUan,n=+Infinity)

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/calculus/calculus.py in limit(ex, dir, taylor, algorithm, **argv)
1415     if algorithm == 'maxima':
1416         if dir is None:
-> 1417             l = maxima.sr_limit(ex, v, a)
1418         elif dir in dir_plus:
1419             l = maxima.sr_limit(ex, v, a, 'plus')

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/interfaces/maxima_lib.py in sr_limit(self, expr, v, a, dir)
985             elif dir == "minus":
986                 L.append(max_minus)
--> 987             return max_to_sr(maxima_eval(([max_limit], L)))
988         except RuntimeError as error:
989             s = str(error)

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.EclObject.__call__ (build/cythonized/sage/libs/ecl.c:8511)()
836         """
837         lispargs = EclObject(list(args))
--> 838         return ecl_wrap(ecl_safe_apply(self.obj,(<EclObject>lispargs).obj))
839
840     def __richcmp__(left, right, int op):

~/sage/local/var/lib/sage/venv-python3.10/lib/python3.10/site-packages/sage/libs/ecl.pyx in sage.libs.ecl.ecl_safe_apply (build/cythonized/sage/libs/ecl.c:6053)()
357             raise KeyboardInterrupt("ECL says: {}".format(message))
358         else:
--> 359             raise RuntimeError("ECL says: {}".format(message))
360     else:
361         return ret

RuntimeError: ECL says: BINDING-STACK overflow at size 10240. Stack can probably be resized.
Proceed with caution.

---------------------------------------------------------------------------------------------------------------------------------------------


Is SAGE able to compute this limit? Should i provide other provisos? Is there another approach I should try?

Edit: The following works:

Uan.limit(n=Infinity,dir='+',taylor=True)


so I guess all is well. I do not know if the fact that Maxima throws an exception when the taylor keyword is ommitted is a bug or not. The documentation for limit says

• "taylor" - (default: False); if True, use Taylor series, which allows more limits to be computed (but may also crash in some obscure cases due to bugs in Maxima).

Maybe this should be amended to indicate that in some cases, taylor=False causes crashes.