1 | initial version |

For reference, I am using Sage 6.3.beta5, in the command-line, on my computer, so the error messages might look slightly different than those you see. (You didn't specify what version of Sage you were using, or whether you were using Sage on your computer, in command-line, in the Sage notebook, on SageMathCloud, ...)

```
sage: version()
'Sage Version 6.3.beta5, Release Date: 2014-07-01'
```

When you are tracking an error, it helps to simplify the expression.

```
sage: limit(n*2n,n=infinity)
sage: limit(n*2n,n=infinity)
File "<ipython-input-1-82ece3d42612>", line 1
limit(n*2n,n=infinity)
^
SyntaxError: invalid syntax
```

The arrow is pointing to the error. In this case, the syntax error is in `2n`

, which you should type as `2*n`

.

Going further,

```
sage: limit(n!,n=infinity)
File "<ipython-input-3-b3d491dc965e>", line 1
limit(n!,n=infinity)
^
SyntaxError: invalid syntax
```

shows you that `n!`

is not recognised. Use `factorial(n)`

.

Also, if you do:

```
sage: limit(n,n=oo)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-5-ed612516482f> in <module>()
----> 1 limit(n,n=oo)
/Applications/sage-6.3.beta5/local/lib/python2.7/site-packages/sage/calculus/calculus.pyc in limit(ex, dir, taylor, algorithm, **argv)
1224 """
1225 if not isinstance(ex, Expression):
-> 1226 ex = SR(ex)
1227
1228 if len(argv) != 1:
/Applications/sage-6.3.beta5/local/lib/python2.7/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.__call__ (build/cythonized/sage/structure/parent.c:8902)()
/Applications/sage-6.3.beta5/local/lib/python2.7/site-packages/sage/structure/coerce_maps.so in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (build/cythonized/sage/structure/coerce_maps.c:4203)()
/Applications/sage-6.3.beta5/local/lib/python2.7/site-packages/sage/structure/coerce_maps.so in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (build/cythonized/sage/structure/coerce_maps.c:4110)()
/Applications/sage-6.3.beta5/local/lib/python2.7/site-packages/sage/symbolic/ring.so in sage.symbolic.ring.SymbolicRing._element_constructor_ (build/cythonized/sage/symbolic/ring.cpp:5229)()
TypeError:
```

and that's because in Sage, `n`

is a shortcut for the `numerical_approximation`

function.

By contrast:

```
sage: limit(x,x=infinity)
+Infinity
```

Note that there is a convenient shortcut for `infinity`

, which is `oo`

, so you can type:

```
sage: limit(x,x=oo)
+Infinity
```

It's true that the error message for `n`

is not very informative!

It gets more informative if you try:

```
sage: limit(2*n,n=infinity)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-9-fdebc251e72d> in <module>()
----> 1 limit(Integer(2)*n,n=infinity)
/Applications/sage-6.3.beta5/local/lib/python2.7/site-packages/sage/structure/element.so in sage.structure.element.RingElement.__mul__ (build/cythonized/sage/structure/element.c:15353)()
/Applications/sage-6.3.beta5/local/lib/python2.7/site-packages/sage/structure/coerce.so in sage.structure.coerce.CoercionModel_cache_maps.bin_op (build/cythonized/sage/structure/coerce.c:8323)()
TypeError: unsupported operand parent(s) for '*': 'Integer Ring' and '<type 'function'>'
```

There, Sage is telling you that it can't multiply an integer (here, `2`

) with a function (here, `n`

).

To use `n`

as a summation variable, first declare it as a symbolic variable:

```
sage: var('n')
n
```

Then things start to work.

```
sage: limit(n,n=oo)
+Infinity
```

And you can input the limit you were trying to compute.

```
sage: lim(((n^(2*n)-2*factorial(n)+n*log(n,10))^((n^(2*n))/factorial(n)))/(n^(((2*n)^(2*n))/(factorial(n-1)))),n=oo)
limit((n^(2*n) + n*log(n)/log(10) - 2*factorial(n))^(n^(2*n)/factorial(n))*n^(-(2*n)^(2*n)/factorial(n - 1)), n, +Infinity)
```

(I didn't know if `2n!`

in your code was for `2*factorial(n)`

or `factorial(2*n)`

.)

Here we see that Sage just returned the same expression. This means that the syntax was correct, that it tried to compute the limit, and couldn't simplify it.

I think the computation of such limits is done by Maxima behind the scenes.

You might want to try and simplify the expression before computing the limit.

2 | No.2 Revision |

For reference, I am using Sage 6.3.beta5, in the command-line, on my computer, so the error messages might look slightly different than those you ~~see. (You didn't specify what version of Sage you were using, or whether you were using Sage on your computer, in command-line, in the Sage notebook, on SageMathCloud, ...)~~see, but presumably they occur in the same places.

```
sage: version()
'Sage Version 6.3.beta5, Release Date: 2014-07-01'
```

When you are tracking an error, it helps to simplify the expression.

```
sage: limit(n*2n,n=infinity)
sage: limit(n*2n,n=infinity)
File "<ipython-input-1-82ece3d42612>", line 1
limit(n*2n,n=infinity)
^
SyntaxError: invalid syntax
```

The arrow is pointing to the error. In this case, the syntax error is in `2n`

, which you should type as `2*n`

.

Going further,

```
sage: limit(n!,n=infinity)
File "<ipython-input-3-b3d491dc965e>", line 1
limit(n!,n=infinity)
^
SyntaxError: invalid syntax
```

shows you that `n!`

is not recognised. Use `factorial(n)`

.

Also, if you do:

```
sage: limit(n,n=oo)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-5-ed612516482f> in <module>()
----> 1 limit(n,n=oo)
/Applications/sage-6.3.beta5/local/lib/python2.7/site-packages/sage/calculus/calculus.pyc in limit(ex, dir, taylor, algorithm, **argv)
1224 """
1225 if not isinstance(ex, Expression):
-> 1226 ex = SR(ex)
1227
1228 if len(argv) != 1:
/Applications/sage-6.3.beta5/local/lib/python2.7/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.__call__ (build/cythonized/sage/structure/parent.c:8902)()
/Applications/sage-6.3.beta5/local/lib/python2.7/site-packages/sage/structure/coerce_maps.so in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (build/cythonized/sage/structure/coerce_maps.c:4203)()
/Applications/sage-6.3.beta5/local/lib/python2.7/site-packages/sage/structure/coerce_maps.so in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (build/cythonized/sage/structure/coerce_maps.c:4110)()
/Applications/sage-6.3.beta5/local/lib/python2.7/site-packages/sage/symbolic/ring.so in sage.symbolic.ring.SymbolicRing._element_constructor_ (build/cythonized/sage/symbolic/ring.cpp:5229)()
TypeError:
```

and that's because in Sage, `n`

is a shortcut for the `numerical_approximation`

function.

By contrast:

```
sage: limit(x,x=infinity)
+Infinity
```

Note that there is a convenient shortcut for `infinity`

, which is `oo`

, so you can type:

```
sage: limit(x,x=oo)
+Infinity
```

It's true that the error message for `n`

is not very informative!

It gets more informative if you try:

```
sage: limit(2*n,n=infinity)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-9-fdebc251e72d> in <module>()
----> 1 limit(Integer(2)*n,n=infinity)
/Applications/sage-6.3.beta5/local/lib/python2.7/site-packages/sage/structure/element.so in sage.structure.element.RingElement.__mul__ (build/cythonized/sage/structure/element.c:15353)()
/Applications/sage-6.3.beta5/local/lib/python2.7/site-packages/sage/structure/coerce.so in sage.structure.coerce.CoercionModel_cache_maps.bin_op (build/cythonized/sage/structure/coerce.c:8323)()
TypeError: unsupported operand parent(s) for '*': 'Integer Ring' and '<type 'function'>'
```

There, Sage is telling you that it can't multiply an integer (here, `2`

) with a function (here, `n`

).

To use `n`

as a summation variable, first declare it as a symbolic variable:

```
sage: var('n')
n
```

Then things start to work.

```
sage: limit(n,n=oo)
+Infinity
```

And you can input the limit you were trying to compute.

```
sage: lim(((n^(2*n)-2*factorial(n)+n*log(n,10))^((n^(2*n))/factorial(n)))/(n^(((2*n)^(2*n))/(factorial(n-1)))),n=oo)
limit((n^(2*n) + n*log(n)/log(10) - 2*factorial(n))^(n^(2*n)/factorial(n))*n^(-(2*n)^(2*n)/factorial(n - 1)), n, +Infinity)
```

(I didn't know if `2n!`

in your code was for `2*factorial(n)`

or `factorial(2*n)`

.)

Here we see that Sage just returned the same expression. This means that the syntax was correct, that it tried to compute the limit, and couldn't simplify it.

I think the computation of such limits is done by Maxima behind the scenes.

You might want to try and simplify the expression before computing the limit.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.