1. Approximating pi

$\displaystyle \pi=4\sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}$

Estimate the number of terms required to approximate $\displaystyle \pi$ to within $\displaystyle 10^{-10}$.
Here's what I have so far:

$\displaystyle \pi-4\sum_{k=N}^{\infty}\frac{(-1)^k}{2k+1} \leq 10^{-10}$

$\displaystyle 4 \sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}-4 \sum_{k=N}^{\infty} \frac{(-1)^k}{2k+1} \leq 10^{-10}$

$\displaystyle 4\sum_{k=N+1}^{\infty}\frac{(-1)^k}{2k+1} \leq 10^{-10}$

$\displaystyle 4(\frac{-1^{N+1}}{2N+3}+\frac{-1^{N+2}}{2N+5}+\frac{-1^{N+3}}{2N+7}+.........) \leq 10^{-10}$

$\displaystyle 4(\frac{-1^{N+1}}{2N+3}+\frac{-1^{N+2}}{2N+5}+\frac{-1^{N+3}}{2N+7}+.........) \leq 4(\frac{-1^{N+1}}{2N}+\frac{-1^{N+2}}{2N}+\frac{-1^{N+3}}{2N}+......) \leq 10^{-10}$

$\displaystyle 4\sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} \leq 4\frac{\frac{-1^{N+1}}{2N}}{1-(-1)} \leq 10^{-10}$

$\displaystyle 4\sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} \leq 4\frac{\frac{-1^{N+1}}{2N}}{2} \leq 10^{-10}$

$\displaystyle 4\sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} \leq \frac{-1^{N+1}}{N} \leq 10^{-10}$

Solving $\displaystyle \frac{-1^{N+1}}{N} \leq 10^{-10}$ gives:

$\displaystyle -1^{N+1} 10^{10} \leq N$

Therefore $\displaystyle N \geq 10^{10}+1$ so $\displaystyle N=10^{10}+1$ terms.

This seems to be a really big answer. I might just be confusing myself but I was also wondering if there was an easier way of doing it (if this is the right way).

2. Originally Posted by Showcase_22
Here's what I have so far:

$\displaystyle \pi-4\sum_{k=N}^{\infty}\frac{(-1)^k}{2k+1} \leq 10^{-10}$

$\displaystyle 4 \sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}-4 \sum_{k=N}^{\infty} \frac{(-1)^k}{2k+1} \leq 10^{-10}$

$\displaystyle 4\sum_{k=N+1}^{\infty}\frac{(-1)^k}{2k+1} \leq 10^{-10}$

$\displaystyle 4(\frac{-1^{N+1}}{2N+3}+\frac{-1^{N+2}}{2N+5}+\frac{-1^{N+3}}{2N+7}+.........) \leq 10^{-10}$

$\displaystyle 4(\frac{-1^{N+1}}{2N+3}+\frac{-1^{N+2}}{2N+5}+\frac{-1^{N+3}}{2N+7}+.........) \leq 4(\frac{-1^{N+1}}{2N}+\frac{-1^{N+2}}{2N}+\frac{-1^{N+3}}{2N}+......) \leq 10^{-10}$

$\displaystyle 4\sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} \leq 4\frac{\frac{-1^{N+1}}{2N}}{1-(-1)} \leq 10^{-10}$

$\displaystyle 4\sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} \leq 4\frac{\frac{-1^{N+1}}{2N}}{2} \leq 10^{-10}$

$\displaystyle 4\sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} \leq \frac{-1^{N+1}}{N} \leq 10^{-10}$

Solving $\displaystyle \frac{-1^{N+1}}{N} \leq 10^{-10}$ gives:

$\displaystyle -1^{N+1} 10^{10} \leq N$

Therefore $\displaystyle N \geq 10^{10}+1$ so $\displaystyle N=10^{10}+1$ terms.

This seems to be a really big answer. I might just be confusing myself but I was also wondering if there was an easier way of doing it (if this is the right way).
As the series is an alternating series, if you consider the sum up to n terms, the error is at most in the first term you neglect.

So if

$\displaystyle S_n = \sum_{k=0}^{n-1} \frac{4 (-1)^k}{2k+1}$ then

$\displaystyle |E_n| \le \frac{4}{2n+1} \le 10^{-10}$ so $\displaystyle n \ge \frac{4 \cdot 10^{10} - 1}{2}$
which is an over kill. For a better answer, you could use Taylor series with remainder.

3. I don't know how to solve this problem, however the following implication is wrong:

Originally Posted by Showcase_22
$\displaystyle 4(\frac{-1^{N+1}}{2N+3}+\frac{-1^{N+2}}{2N+5}+\frac{-1^{N+3}}{2N+7}+.........) \leq 4(\frac{-1^{N+1}}{2N}+\frac{-1^{N+2}}{2N}+\frac{-1^{N+3}}{2N}+......) \leq 10^{-10}$

$\displaystyle 4\sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} \leq 4\frac{\frac{-1^{N+1}}{2N}}{1-(-1)} \leq 10^{-10}$
You have used infinite term geometric series formula carelessly. The common ratio, here, is -1. And the geometric series formula does not apply...

4. awww, I thought I had the answer in the bag! =(

I should have spotted there was an error there since I did know that any alternating decreasing sequence, when summed to infinity, can be rearranged to sum to any real number.

The hardest part here is making the series $\displaystyle 4 \sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1}$ into a geometric series so it can be summed. I've just got no idea what to turn it into.

5. Originally Posted by Showcase_22

I should have spotted there was an error there since I did know that any alternating decreasing sequence, when summed to infinity, can be rearranged to sum to any real number.

The hardest part here is making the series $\displaystyle 4 \sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1}$ into a geometric series so it can be summed. I've just got no idea what to turn it into.
But you cannot really make it into a geometric series. Instead, consider the series given by $\displaystyle \frac{1}{1+x^2}=\sum_{n=0}^{\infty}(-1)^nx^{2n}$. Now how could you get your sum from this? Hint in white: consider the integral from zero to one, consider it when the function is as it is and when it is in series notation.

6. The series converges conditionally, hence, the integral approach it's just to get a simple value.

7. Originally Posted by Mathstud28
But you cannot really make it into a geometric series. Instead, consider the series given by $\displaystyle \frac{1}{1+x^2}=\sum_{n=0}^{\infty}(-1)^nx^{2n}$. Now how could you get your sum from this? Hint in white: consider the integral from zero to one, consider it when the function is as it is and when it is in series notation.
I would like to point out that I thought "whaaaaat...." and had to look at the hint. =(

Is this what you mean:

$\displaystyle \int_0^1 \frac{1}{1+x^2} dx$

$\displaystyle x=sinh^2u, \ \frac{dx}{du}=2 \ sinhu \ coshu$

$\displaystyle \int_{sinh^2 0=0}^{sinh^2 1} \frac{2 \ sinh u \ cosh u}{1+sinh^2 u}du$

$\displaystyle 2\int_0^{sinh^2 1}\frac{sinh u \ cosh u}{cosh^2 u}du$

$\displaystyle 2 \int_0^{sinh^2 1} {tanh \ u}\ du= \ [ln (cosh u)]_0^{sinh^2 1}$

?

8. Originally Posted by Showcase_22
I would like to point out that I thought "whaaaaat...." and had to look at the hint. =(

Is this what you mean:

$\displaystyle \int_0^1 \frac{1}{1+x^2} dx$

$\displaystyle x=sinh^2u, \ \frac{dx}{du}=2 \ sinhu \ coshu$

$\displaystyle \int_{sinh^2 0=0}^{sinh^2 1} \frac{2 \ sinh u \ cosh u}{1+sinh^2 u}du$

$\displaystyle 2\int_0^{sinh^2 1}\frac{sinh u \ cosh u}{cosh^2 u}du$

$\displaystyle 2 \int_0^{sinh^2 1} {tanh \ u}\ du= \ [ln (cosh u)]_0^{sinh^2 1}$

?
$\displaystyle \int \frac{dx}{1+x^2} = \tan^{-1}x + c$

9. Ohhh....right. I saw my way of doing t and got lost in what I was doing.

$\displaystyle arctan \ x= x-\frac{x^3}{3}+\frac{x^5}{5}-\frac{x^7}{7}........=\sum_{k=0}^ {\infty}\frac{(-1)^{k}}{2k+1}$

I need: $\displaystyle \pi=4\sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}$

I see what I need here. From my original calculation I have:

$\displaystyle 4 \sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}-4 \sum_{k=N}^{\infty} \frac{(-1)^k}{2k+1} \leq 10^{-10}$

$\displaystyle 4arctan \ 1-4\sum_{k=N}^{\infty} \frac{(-1)^k}{2k+1} \leq 10^{-10}$

$\displaystyle 4 arctan \ 1 - 4(\frac{(-1)^N}{2N+1}+\frac{(-1)^{N+1}}{2N+3}+\frac{(-1)^{N+2}}{2N+5}+.......)$

$\displaystyle \leq 4 arctan \ 1 - 4(\frac{(-1)^N}{1}+\frac{(-1)^{N+1}}{3}+\frac{(-1)^{N+2}}{5}+.......) \leq 10^{-10}$

$\displaystyle 4 arctan \ 1 - 4(-1)^N(\frac{1}{1}+\frac{-1}{3}+\frac{1}{5}+.......) \leq 10^{-10}$

$\displaystyle 4 arctan \ 1 -4(-1^N)arctan \ 1 \leq 10^{-10}$

$\displaystyle 4arctan \ 1 (1-(-1^N) \leq 10^{-10}$

$\displaystyle 1-(-1^N) \leq \frac{1}{10^{10}( 4arctan 1)}$

$\displaystyle 1-\frac{1}{10^{10}(4arctan 1)} \leq -1^N$

hmm, surely this is just valid for N=2?

10. Originally Posted by Showcase_22
Here's what I have so far:

$\displaystyle \pi-4\sum_{k=N}^{\infty}\frac{(-1)^k}{2k+1} \leq 10^{-10}$

$\displaystyle 4 \sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}-4 \sum_{k=N}^{\infty} \frac{(-1)^k}{2k+1} \leq 10^{-10}$

$\displaystyle 4\sum_{k=N+1}^{\infty}\frac{(-1)^k}{2k+1} \leq 10^{-10}$

$\displaystyle 4(\frac{-1^{N+1}}{2N+3}+\frac{-1^{N+2}}{2N+5}+\frac{-1^{N+3}}{2N+7}+.........) \leq 10^{-10}$

$\displaystyle 4(\frac{-1^{N+1}}{2N+3}+\frac{-1^{N+2}}{2N+5}+\frac{-1^{N+3}}{2N+7}+.........) \leq 4(\frac{-1^{N+1}}{2N}+\frac{-1^{N+2}}{2N}+\frac{-1^{N+3}}{2N}+......) \leq 10^{-10}$

$\displaystyle 4\sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} \leq 4\frac{\frac{-1^{N+1}}{2N}}{1-(-1)} \leq 10^{-10}$

$\displaystyle 4\sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} \leq 4\frac{\frac{-1^{N+1}}{2N}}{2} \leq 10^{-10}$

$\displaystyle 4\sum_{k=N+1}^{\infty}\frac{-1^k}{2k+1} \leq \frac{-1^{N+1}}{N} \leq 10^{-10}$

Solving $\displaystyle \frac{-1^{N+1}}{N} \leq 10^{-10}$ gives:

$\displaystyle -1^{N+1} 10^{10} \leq N$

Therefore $\displaystyle N \geq 10^{10}+1$ so $\displaystyle N=10^{10}+1$ terms.

This seems to be a really big answer. I might just be confusing myself but I was also wondering if there was an easier way of doing it (if this is the right way).
Numerical experiment is always worth a look:

Code:
log_10(N)         log_10(|error|)
2                    -2.0043
3                    -3.0003
4                    -4.00004
5                    -5.00000
6                    -6.00000
7                    -7.00000
at which point brute force runs out of umph!

But it looks like a tight bound on the number of terms needed should be ~=10^10

.

11. An alternative approach to this problem is to group the terms in pairs to turn the series into a series of decreasing positive terms, then to get bounds for the sum of the tail by constructing integrals that over and under estimate the sum of the tail.

We start by writting:

$\displaystyle \sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}=\sum_{n=0}^{\infty}\left( \frac{1}{4n+1}-\frac{1}{4n+3}\right)=\sum_{n=0}^{\infty}\frac{2}{ (4n+1)(4n+3)}$

(though if we need $\displaystyle N$ terms this series to get the error under $\displaystyle 10^{-10}$ we need $\displaystyle 2N$ terms of the original series)

.

12. Originally Posted by Showcase_22
I would like to point out that I thought "whaaaaat...." and had to look at the hint. =(

Is this what you mean:

$\displaystyle \int_0^1 \frac{1}{1+x^2} dx$

$\displaystyle x=sinh^2u, \ \frac{dx}{du}=2 \ sinhu \ coshu$

$\displaystyle \int_{sinh^2 0=0}^{sinh^2 1} \frac{2 \ sinh u \ cosh u}{1+sinh^2 u}du$

$\displaystyle 2\int_0^{sinh^2 1}\frac{sinh u \ cosh u}{cosh^2 u}du$

$\displaystyle 2 \int_0^{sinh^2 1} {tanh \ u}\ du= \ [ln (cosh u)]_0^{sinh^2 1}$

?
$\displaystyle \int_0^1\frac{dx}{1+x^2}=\arctan(x)\bigg|_{x=0}^{x =1}=\frac{\pi}{4}$

But also note that

\displaystyle \begin{aligned}\int_0^1\frac{dx}{1+x^2}&=\int_0^1\ sum_{n=0}^{\infty}(-1)^nx^{2n}dx\\ &=\sum_{n=0}^{\infty}\int_0^1(-1)x^{2n}dx\quad{\color{red}(*)}\\ &=\sum_{n=0}^{\infty}\frac{(-1)^n}{2n+1}\end{aligned}

So we can conclude that $\displaystyle \sum_{n=0}^{\infty}\frac{(-1)^n}{2n+1}=\frac{\pi}{4}$

Note: The following may be unesccesary, but just in case.

$\displaystyle \color{red}(*)$ can be justified using Abel's Test for Uniform Convergence since if we let $\displaystyle f_n(x)=x^n$ and $\displaystyle \frac{(-1)^n}{2n+1}=a_n$ we can see that $\displaystyle \sum a_n$ converges and $\displaystyle f_n(x)$ is nonincreasing and bounded on $\displaystyle [0,1]$

13. Originally Posted by Constatine11
An alternative approach to this problem is to group the terms in pairs to turn the series into a series of decreasing positive terms, then to get bounds for the sum of the tail by constructing integrals that over and under estimate the sum of the tail.

We start by writting:

$\displaystyle \sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}=\sum_{n=0}^{\infty}\left( \frac{1}{4n+1}-\frac{1}{4n+3}\right)=\sum_{n=0}^{\infty}\frac{2}{ (4n+1)(4n+3)}$

(though if we need $\displaystyle N$ terms this series to get the error under $\displaystyle 10^{-10}$ we need $\displaystyle 2N$ terms of the original series)

.
That's a very clever method!

$\displaystyle \pi= \sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}$

$\displaystyle \sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}-\sum_{k=0}^{N} \frac{(-1)^k}{2k+1} \leq 10^{-10}$

$\displaystyle \sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}-\sum_{n=0}^{2N} \frac{2}{(4n+1)(4n+3)} \leq 10^{-10}$

So is this what I need to work out? $\displaystyle n=\frac{k}{2}$ if k is even, but can I use this fact at all? (or is this what you used to get the sum to 2N?).

I have another query: Since this series is a sum to infinity, can the individual terms be grouped together in this way? I was wondering this because if $\displaystyle a_n=\frac{1}{2k+1}$ then $\displaystyle a_n$ is a decreasing null sequence of non-negative terms. Therefore $\displaystyle \sum_{k=0}^{\infty} (-1)^k a_n$ can be used to sum the series to any real number.

14. This question relies on the fact that $\displaystyle E=|S_{n+1}-S_n|$ where E= error (I think so anyway).

Therefore:

$\displaystyle |S_{n+1}-S_n| \leq 10^{-10}$

$\displaystyle 4|\sum_{k=(n+1)}^\infty\frac{(-1^k)}{2k+1}-\sum_{k=n}^{\infty}\frac{(-1)^k}{2k+1}| \leq 10^{-10}$

$\displaystyle 4|\frac{-1^{n+1}}{2(n+1)+1}| \leq 10^{-10}$

$\displaystyle 4(\frac{1}{2n+3}) \leq 10^{-10}$

$\displaystyle \frac{4}{2n+3} \leq \frac{1}{10^{10}}$

$\displaystyle 4 \cdot10^{10} \leq 2n+3$

$\displaystyle 4 \cdot 10^{10}-3 \leq 2n$

$\displaystyle 4 \cdot \frac{10^{10}-3}{2} \leq n$

so $\displaystyle N \geq 2(10^{10}-3)$

This is pretty big given constatine11's "brute strength" approach from before. However, I think this is about right because I can't see any other way of doing it!

15. Originally Posted by Constatine11
An alternative approach to this problem is to group the terms in pairs to turn the series into a series of decreasing positive terms, then to get bounds for the sum of the tail by constructing integrals that over and under estimate the sum of the tail.

We start by writting:

$\displaystyle \sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1}=\sum_{n=0}^{\infty}\left( \frac{1}{4n+1}-\frac{1}{4n+3}\right)=\sum_{n=0}^{\infty}\frac{2}{ (4n+1)(4n+3)}$

(though if we need $\displaystyle N$ terms this series to get the error under $\displaystyle 10^{-10}$ we need $\displaystyle 2N$ terms of the original series)

.
The idea here is that if $\displaystyle f(x)$ is a positive decreasing function for $\displaystyle x>n-1$ then

$\displaystyle \int_{n-1}^{\infty} f(x)\ dx \ge \sum_{k=n}^{\infty}f(k) \ge \int_{n}^{\infty} f(x)\ dx$

So finding an $\displaystyle N$ such that

$\displaystyle \int_{N-1}^{\infty} f(x)\ dx < \frac{10^{-10}}{4}$

will give us a number of terms that will suffice to give the required error limit on the sum.

Doing the sums (at this point I resort to the use of Maxima for doing the integral. and the algebra) gives $\displaystyle N\approx 5\times 10^9$ (in fact slightly less if we use double precision floating point, but with higher precision we find that any $\displaystyle N>5 \times 10^9$ will do) but this is half the number of terms needed for the original series so for the original series you need no more than $\displaystyle 10^{10}+2$ terms

.

Page 1 of 2 12 Last