I was looking at Why $\sum_{i=1}^n \frac{1}{i} =\mathcal O(\ln(n))$?. And there it was proved that $$\sum_{i=1}^n \frac{1}{i} =\mathcal O(\ln(n))$$ My question is that does this also stand for $$\sum_{i=1}^n \frac{1}{i^2}$$ If so why?
Asked
Active
Viewed 99 times
2
-
3Certainly, as $0 \leq \frac{1}{i^2} \leq \frac{1}{i}$ and, as you've observed, $\sum_{i = 1}^n = O(\ln n)$. In fact, $\sum_{i = 1}^{\infty} \frac{1}{i^2}$ converges, so the $n$th partial sum is $O(1)$. – Travis Willse Feb 03 '16 at 23:05
-
Minor nitpickery (that should also go on the other post, but): it's IMHO much more pedagogically useful to think of $O(f(n))$ as a set of functions and then to write, for instance, $\sum_{i=1}^n \frac1{i^2}\in O(\ln n)$ - that is, that it's a member of the set - rather than saying that it equals $O(\ln n)$. For instance, this lets you straightforwardly express the stronger result that people are talking about: $\sum_{i=1}^n\frac1{i^2}\in O(1)\subseteq O(\ln n)$, so the sum must also be $\in O(\ln n)$. – Steven Stadnicki Feb 03 '16 at 23:21
-
@StevenStadnicki I am actually interested in the answer presented in http://math.stackexchange.com/questions/1634063/the-accuracy-from-left-to-right-and-that-from-right-to-left-of-the-floating-poin. Can you explain to me how LutzL arrived at that answer? – user310546 Feb 03 '16 at 23:32
1 Answers
4
You have $$ 0 \leq \sum_{i=1}^n \frac{1}{i^2}\leq \sum_{i=1}^\infty \frac{1}{i^2} = \frac{\pi^2}{6} $$ (the series converges) so, yes, you do have $\sum_{i=1}^n \frac{1}{i^2} = O(\log n)$. But this is because you actually have the stronger statement $\sum_{i=1}^n \frac{1}{i^2} = O(1)$.

Clement C.
- 67,323
-
Now, I know that when the sum is calculated from the left to right, you get $O(n)$, but then why is it $O(\log(n))$ from right to left as indicated by the link? – user310546 Feb 03 '16 at 23:09
-
-
@user310546 What do you mean by "is $O(n)$ when computed from the left to the right"? – Clement C. Feb 03 '16 at 23:10
-
I am saying that coming from this link: http://math.stackexchange.com/questions/1634063/the-accuracy-from-left-to-right-and-that-from-right-to-left-of-the-floating-poin – user310546 Feb 03 '16 at 23:11
-
As for the yes: $a_n = \sum_{i=1}^n \frac{1}{i^2}$ defines an increasing sequence that converges to the number $\ell = \frac{\pi^2}{6} > 0$, so that $0 < a_n < \ell$ for all $n$. In particular, $a_n = O(1)$, and a fortiori $a_n = O(\log n)$ (since for $n$ big enough, $\log n \gg \ell$). – Clement C. Feb 03 '16 at 23:12
-
@user310546 From the link you have just given, it looks like you are confused between the value of the sum, and the accuracy when computing this value using some specific model of computation (here, floating-point arithmetic, as on a computer's processor). The link you gave deals with the latter: you can compute the sum starting from the last terms, or starting from the first terms: the value of the sum is of course the same, but the approximation of this value you will get will not necessarily be (the errors that accumulate in computing it will not be the same). – Clement C. Feb 03 '16 at 23:16
-
But then why do you get a different accuracy? Why does it matter which way you go? I don't quite understand the answer that is given in that link. – user310546 Feb 03 '16 at 23:19
-
1At a very high and sketchy level: because you have a fixed amount of memory to store each number. If you store a very small number, then this memory is used for the very fine precision (not storing the leading zeros), but if you have a big number, then this memory cannot store the same fine-grained precision (most of the memory stores the significant digits). So if you start with $1$, then add a smaller number, you will not be (relatively) as precise as if you had stored the small number (to very good precision), then added $1$ (only losing precision in the last digits now). – Clement C. Feb 03 '16 at 23:24
-
Ok. Last question. How can what you showed here be used in the other problem I linked? – user310546 Feb 03 '16 at 23:25
-
-
The second link I showed. Since I don't understand the answer there, would you mind providing me an explanation as to how LutzL arrived at that conclusion – user310546 Feb 03 '16 at 23:29
-
Unfortunately, I don't feel like I can provide a better answer: I understand the argument, but am not a specialist of these considerations (floating-point precision -- I am mostly ignoring these numerical considerations in my everyday life). You should probably ask another question about it, linking this one in the statement, and asking for clarifications. – Clement C. Feb 03 '16 at 23:39