1

Suppose we have a convergent series $s_k=\sum_{n=0}^{k} a_n$ or sequence $\{a_n\}$ with limit $a$.

How can I determine $N \in \mathbb N$ such that $|s_k-a| \le \epsilon$ or $|a_n-a| \le \epsilon$ $ \ \ \forall \ n \ge N$.

This question has a lot of interest to me. Recently I proved the Leibniz' series is convergent with limit $\frac \pi 4$. I want to create a computer program that calculates $\pi$ from this series (it might be ineffective). However I know only the limit of the series, I don't know how many iterations to make before reaching $N \in \mathbb N$ such that the computation is within the required precision $\epsilon > 0$ for $n \ge N$ iterations.

Shuzheng
  • 5,533
  • Depending on the type of series you have, there are different types of techniques available. As far as I know, there is no universal technique that works all the time in finding such $N$. – Braindead Mar 23 '14 at 12:16
  • For series, remainder estimates are often helpful; for sequences, if you know the sequence is eventually monotone, or that even and odd terms are both eventually monotone, that is helpful. – MPW Mar 23 '14 at 12:21

2 Answers2

2

The Alternating Series Test says that for a sequence of positive numbers, $a_n$, that decreases monotonically to $0$, $$ a=\sum_{k=1}^\infty(-1)^ka_k $$ converges and the difference $$ \left|a-\sum_{k=1}^n(-1)^ka_k\right|\le\left|a_{n+1}\right| $$ So you just need to include terms in the Leibniz Series until the next term is smaller than the error you desire.


Note that the Leibniz Series, which is the evaluation of the Gregory Series at $x=1$ and converges extremely slowly, can be accelerated as in this question using Euler's Series Transformation to get the much more quickly converging series $$ \frac{\pi}{2}=\sum_{k=0}^\infty\frac{k!}{(2k+1)!!} $$

robjohn
  • 345,667
1

This Leibniz series has the property that its terms alternate in sign and their absolute values are monotone decreasing to zero. For such sequences, if $s_n$ is the sum of the first $n$ terms, then the sum $s$ of the series is always somewhere between $s_n$ and $s_{n+1}.$ So in making a program with tolerance say $0.01$ you just need to keep (careful) track of the partial sums and go until you get two in a row which are at most a certain distance apart to get the accuracy you want.

[It is another thing to guarantee correct digits, as the values of the parial sums will not necessarily give intervals for which one knows the first $k$ digits, but that could be accommodated in the program by going until successive $s_n,s_{n+1}$ both lie in an interval where the digits can be predicted up to some point.]

coffeemath
  • 29,884
  • 2
  • 31
  • 52
  • How does one strictly prove that $a$ always lies between $s_n$ and $s_{n+1}$. Intuition tells me it is correct. – Shuzheng Mar 23 '14 at 17:38
  • 1
    Say the even indexed terms are negative. Then the sequence of odd indexed partial sums is monotone decreasing, and the sequence of even indexed partial sums is monotone increasing. Each of these is bounded, so each has a limit. Then these two limits must be the same (and equal to the overall limit $a$ [the infinite sum]). – coffeemath Mar 23 '14 at 18:06