# Limit not giving expected result

I am taking the limit

Limit[Sin[π Sqrt[4 n^2 + n]], n -> ∞]


Interval[{-1, 1}]


I think the right answer is $$\frac{1}{\sqrt{2}}$$

I am using 10.0. What is happening?

• Compare DiscretePlot[Sin[\[Pi] Sqrt[4 n^2 + n]], {n, 0, 100}] with Plot[Sin[\[Pi] Sqrt[4 n^2 + n]], {n, 0, 100}] Oct 23, 2014 at 15:39
• Hi Artes they say here: mathisfunforum.com/viewtopic.php?pid=338773#p338773 Oct 23, 2014 at 15:41
• @bobbym They are considering a discreet variable, while Mma considers the Limit[] var as continous Oct 23, 2014 at 16:00
• Your question is ill posed, you assume that n is neccesarily integer but you don't put your assumption to your formula. Oct 23, 2014 at 16:22
• @bobbym There is no limit if you take a real valued argument because between n and n+1 the argument takes all real values and then the function gives all real numbers between -1 and 1. You could put your problem this way ; Limit[Sin[Pi Sqrt[4 n^2 + n]], n -> Infinity, Assumptions -> n \[Element] Integers] and it returns the desired value. Oct 23, 2014 at 16:33

You have to tell Mathematica explicitly that n is supposed to be an integer:

Assuming[n ∈ Integers, Limit[Sin[π Sqrt[4 n^2 + n]], n -> ∞]]
(*
==> 1/Sqrt[2]
*)

• Nice! I'm sure I've tried that in the past and it didn't work Oct 23, 2014 at 16:15
• I didn't think that would work either.. Oct 23, 2014 at 16:35
• @Daniel This kind of violation of expectations has happened many times in the past. It shows that there is a lot of room for improvement here: either in the way this functionality is accessed, or in the documentation. Several of us looked at this question and it never occurred to most of us that this might work. (It already works in v8.) The documentation mentions nothing about this, but even if it did, it would be hard to discover ... It would appear that Limit has separate cases for sequences and continuous limits. This should be very clearly explained under Details in the documentation. Oct 23, 2014 at 17:00
• @Daniel There are so many things like this in Mathematica, even the relatively known Integrate[Boole[...] ..., ...] is practically undocumented outside examples and would be hard to discover for someone who doesn't participate on forums like this and doesn't see a lot of Mathematica code every day. It's really a separate functionality that's hidden under the meta-function "Integrate". It would be a pity for these gems to be lost just because they're so hard to discover. Oct 23, 2014 at 17:03
• @Szabolcs I think that use of Assuming of integrality in Limit works more or less by accident. I would not want to document a behavior I had no reason to think was reliable. Oct 23, 2014 at 20:35

Here is a way to use Mathematica to find numerical limits for discrete variables:

Needs["NumericalCalculus"]
u = IntegerPart;
NLimit[Sin[Pi Sqrt[4 u[n]^2 + u@n]], n -> ∞]
(* 0.707107 *)

• I was aware of NLimit but I just thought it used a numerical method to get a function limit. I did not realize as your plots show that the two limits are different. Oct 23, 2014 at 16:12
• Note that there appears to be a bug in Limit since Limit[Sin[Pi Sqrt[4 IntegerPart[n]^2 + IntegerPart[n]]], n-> Infinity] returns the wrong answer Interval[{-1,1}]`. May 29, 2016 at 21:10