Estimating error when calculating $\pi^2$ with $8 + \frac{8}{3^2} + \frac{8}{5^2} + \frac{8}{7^2} + \cdots$

194 Views Asked by At

While answering a CodeReview question (Approximating constant $\pi^2$ to within error), I noticed that when calculating the sum $$8 + \dfrac{8}{3^2} + \dfrac{8}{5^2} + \dfrac{8}{7^2} + \dfrac{8}{9^2} + \cdots $$

and stopping at the smallest term larger than $\varepsilon$, the difference to $\pi^2$ seems very close to $\sqrt{2\varepsilon}$.

With $$n = \left\lfloor\frac{\sqrt{\frac{8}{\varepsilon}} - 1}{2} \right\rfloor,$$

it looks like:

$$\sum_{i=0}^n \frac{8}{(2i+1)^2} \approx \pi^2 - \sqrt{2\varepsilon}.$$

For example, with $\varepsilon = 10^{-10}$:

$n = 141421$

$\sum = 9.86959025 \dots$

$\pi^2 - \sum \approx 1.4142170*10^{-5}$

$(\pi^2 - \sum)^2 \approx 2.0000099*10^{-10} \approx 2\varepsilon$

I don't think it's a coincidence, but I don't know where to begin to link

$$\sum_{i=n+1}^\infty \frac{8}{(2i+1)^2}$$ to $\sqrt{2\varepsilon}$.

Wolfram Alpha expresses this sum in terms of a polygamma function but I don't know anything about it.

Is the approximation correct? Is there any simple way to prove it?

2

There are 2 best solutions below

2
On

One has $${2\over (2k+1)^2}<{1\over 2k}-{1\over 2k+2}\ ,$$ and therefore (teleskoping sum!) $$0<\sum_{k=n}^\infty{2\over(2k+1)^2}<{1\over 2n}\ ,$$ or $$0<\sum_{k=n}^\infty{8\over(2k+1)^2}<{2\over n}\ .$$ Maybe this will bring you over the top.

12
On

Recall from calculus the integral test:

$$\displaystyle\sum a(n)\text{ converges if and only if }\int a(x)\text{ converges}$$ where the sequence $a(n)=a_n>0$ and $a_n$ is decreasing, and the function $a(x)$ is continuous.

From the proof of this statement, we can deduce the inequality: if $\sum_{n=1}^\infty a_n=L$, then $$\left|L-\sum_{i=0}^n a_n\right|\leq\int_{n}^\infty a(x)\,dx,$$(see here for help with providing visual intuition as to why the inequality is true) where the notation $a(x)$ is used to represent $a_n$ with the $n$ replaced by $x$. Thus, performing the necessary calculations, we find

\begin{align*} \int_{n}^\infty\frac{8}{(2x+1)^2}\,dx&=\frac{4}{2n+1}\\ &\leq\frac{4}{\sqrt{\frac{8}\varepsilon}-1}\\ &=\frac{1}{\sqrt{\frac{1}{2\varepsilon}}-\frac14}\\ &=\frac{\sqrt{2\varepsilon}}{1-\frac{\sqrt{2\varepsilon}}{4}}\\ &\approx \sqrt{2\varepsilon},\end{align*} where I've taken $$n=\left\lfloor\frac{\sqrt{\frac{8}{\varepsilon}}-1}{2}\right\rfloor.$$