7
$\begingroup$

I am taking the limit

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

the returned answer is

Interval[{-1, 1}]

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

I am using 10.0. What is happening?

$\endgroup$
8
  • 2
    $\begingroup$ Compare DiscretePlot[Sin[\[Pi] Sqrt[4 n^2 + n]], {n, 0, 100}] with Plot[Sin[\[Pi] Sqrt[4 n^2 + n]], {n, 0, 100}] $\endgroup$ Oct 23, 2014 at 15:39
  • $\begingroup$ Hi Artes they say here: mathisfunforum.com/viewtopic.php?pid=338773#p338773 $\endgroup$
    – bobbym
    Oct 23, 2014 at 15:41
  • $\begingroup$ @bobbym They are considering a discreet variable, while Mma considers the Limit[] var as continous $\endgroup$ Oct 23, 2014 at 16:00
  • 2
    $\begingroup$ Your question is ill posed, you assume that n is neccesarily integer but you don't put your assumption to your formula. $\endgroup$
    – Artes
    Oct 23, 2014 at 16:22
  • 4
    $\begingroup$ @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. $\endgroup$
    – Artes
    Oct 23, 2014 at 16:33

2 Answers 2

9
$\begingroup$

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]
*)
$\endgroup$
5
  • 1
    $\begingroup$ Nice! I'm sure I've tried that in the past and it didn't work $\endgroup$ Oct 23, 2014 at 16:15
  • 2
    $\begingroup$ I didn't think that would work either.. $\endgroup$ Oct 23, 2014 at 16:35
  • 1
    $\begingroup$ @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. $\endgroup$
    – Szabolcs
    Oct 23, 2014 at 17:00
  • 1
    $\begingroup$ @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. $\endgroup$
    – Szabolcs
    Oct 23, 2014 at 17:03
  • $\begingroup$ @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. $\endgroup$ Oct 23, 2014 at 20:35
6
$\begingroup$

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 *)
$\endgroup$
2
  • $\begingroup$ 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. $\endgroup$
    – bobbym
    Oct 23, 2014 at 16:12
  • $\begingroup$ 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}]. $\endgroup$
    – Axel Boldt
    May 29, 2016 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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