10
$\begingroup$

Bug introduced in year 2002 (?) and fixed in 11.0


Since $(1-\frac{1}{n})^n\to 1/e$ and $(1+1/n)^n\to e$, the sequence $(1+\frac{(-1)^n}{n})^n$ has no limit as $n\to\infty$, but has limits for odds and even numbers. If $n$ were taken to be real, there would be oscillation through the interval $[1/e,e]$. However, Mathematica 10.4 as well as Wolfram Alpha give

Limit[(1 + (-1)^n/n)^n, n -> Infinity]=1

Am I missing something?

$\endgroup$
  • 1
    $\begingroup$ Please do not use the bugs tag when posting new questions. This tag is special and it is meant to be added by someone else than the original poster, only after the bug was confirmed by the community. $\endgroup$ – Szabolcs May 24 '16 at 8:35
  • 1
    $\begingroup$ I thought that tag (limit) existed, and was surprised to see it missing. I thought it did exist in the past ... BTW yes, it looks pretty much like a bug. I'll let someone else put the tag back. $\endgroup$ – Szabolcs May 24 '16 at 8:50
  • 1
    $\begingroup$ for me, it's a bug. $\endgroup$ – user36273 May 24 '16 at 9:23
  • 3
    $\begingroup$ Turns out this is over 14 years old. Good thing it was reported before it got a drivers license and started doing real damage. (I'm not really intending to take a cavalier attitude toward bugs, it's just that I am amazed this went under the radar for so long). $\endgroup$ – Daniel Lichtblau May 24 '16 at 19:24
  • 1
    $\begingroup$ CVS history (after tracking down the offending bit of code). $\endgroup$ – Daniel Lichtblau May 25 '16 at 15:44
5
$\begingroup$

It is definitely a bug.

And it can be formuated even more sharply.

$Version

(* Out[156]= "10.1.0  for Microsoft Windows (64-bit) (March 24, 2015)" *)

Define

f[n_, a_] := (1 + (-1)^n/n^a)^n

If a>0 the limit exists and is equal to unity. If a == 0 we have the problem of the OP, where one might say that "two alternative limits exist". This is sometimes acknowledged my Mathamtica by indicating an interval in the quantity is to be found for large n. But this does not happen in our case.

But here comes the ultimate shock: Mathematica returns the limit 1 even if 0<a<1.

Indeed, Mathematica tells us that

Table[Limit[f[n, 1/k], n -> \[Infinity]], {k, 2, 5}]

(* Out[117]= {1, 1, 1, 1} *)

whereas mathematically none of these limits exist:

The even members diverge like Exp[n^(1-1/k)]

Table[Limit[(1 + 1/n^((1/k)))^ n, n -> \[Infinity]], {k, 2, 5}]

(* Out[143]= {\[Infinity], \[Infinity], \[Infinity], \[Infinity]} *)

and the odd members go to zero

Table[
 Limit[(1 - 1/n^((1/k)))^ n, n -> \[Infinity]], {k, 2, 5}]

(* Out[141]= {0, 0, 0, 0} *)
| improve this answer | |
$\endgroup$
  • 2
    $\begingroup$ I wrote no such thing. I said the bug had been around for 14 years. I did not state it was well known, or even known. Had it been known, it would have been fixed. I'll trust you to edit the post to reflect the actual remarks. $\endgroup$ – Daniel Lichtblau May 27 '16 at 16:21
  • $\begingroup$ @Danile Lichtblau: all refrence to you deleted. Still, I would have expected recognition of my sharper formulation of the bug instead of being downvalued to 0 by somebody. $\endgroup$ – Dr. Wolfgang Hintze May 29 '16 at 8:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.