# Finding my mistake in approximating the sum of this Leibniz series

I have the following Leibniz series,

$$S=\sum_{n=1}^\infty(-1)^{n+1}a_n=\sum_{n=1}^\infty(-1)^{n+1}\tan\left(\frac{\pi}{2^{n+1}}\right)$$ and I am asked to find an approximation of the sum $R<\tan(10^{-5})$.

My attempt

I know that for a Leibniz series, $$R=\left|S-S_n\right|<a_{n+1}$$ So $a_{n+1}$ controls the remainder of the sum.

$$a_{n+1}=\tan\left(\frac{\pi}{2^{n+2}}\right)<\tan(10^{-5})\implies n>16$$

But I checked in Wolfram Alpha and got $S-S_{17}>\tan(10^{-5})$

What did I do wrong?

EDIT:

I got confused (because I was working with this series earlier) and what I checked in Wolfram Alpha is the following difference: $$\sum_{n=1}^\infty\tan\left(\frac{\pi}{2^{n+1}}\right)-\sum_{n=1}^{17}\tan\left(\frac{\pi}{2^{n+1}}\right)$$

• I show $S \approx 0.71897$ – Doug M Jun 6 '18 at 17:08
• Unless this series has some historical connexion to Liebnitz, there is no reason to call it a Liebnitz series. – DanielWainfleet Jun 7 '18 at 1:49
• My textbook says that a series which converges by the Leibnitz criterion can be called a Leibnitz series. I believe this series converges by that criterion – Lorenzo B. Jun 7 '18 at 7:45
• That agrees with Wikipedia. I hadn't heard al alternating series called a Liebnitz series before. – DanielWainfleet Jun 7 '18 at 20:33

I have done the computations in Mathematica.

In[2]:= s =
NSum[(-1)^(n + 1) Tan[\[Pi]/2^(n + 1)], {n, 1, \[Infinity]}]

Out[2]= 0.718967

In[3]:= ArcTan[
Abs[s - NSum[(-1)^(n + 1) Tan[\[Pi]/2^(n + 1)], {n, 1, 17}]]]

Out[3]= 3.99474*10^-6


This last result is certainly less than $10^{-5}$.

• Thank you, I got confused and I checked for the series without $(-1)^{n+1}$ – Lorenzo B. Jun 6 '18 at 18:20

A not-so-small addendum just for fun. By applying $\frac{d}{dz}\log(\cdot)$ to the Weierstrass product for the cosine function we have $$\tan(z) = \sum_{m\geq 1}\frac{2(4^m-1)\zeta(2m)}{\pi^{2m}}z^{2m-1} \tag{1}$$ for any $z\in\mathbb{C}$ such that $|z|<\frac{\pi}{2}$. By evaluating $(1)$ at $z=\frac{\pi}{2^{n+1}}$ we get $$\tan\left(\frac{\pi}{2^{n+1}}\right) = \frac{2}{\pi}\sum_{m\geq 1}\frac{(4^m-1)\zeta(2m)}{ 2^{(2m-1)(n+1)}}\tag{2}$$ and since $\sum_{n\geq 1}\frac{(-1)^{n+1}}{2^{(2m-1)(n+1)}}=\frac{4^{1-m}}{4^m+2}$ we have $$S = \frac{8}{\pi}\sum_{m\geq 1}\frac{(4^m-1)\zeta(2m)}{4^m(4^m+2)}\tag{3}$$ which allows a more efficient numerical evaluation: $$\left|S -\frac{8}{\pi}\sum_{m= 1}^{\color{red}9}\frac{(4^m-1)\zeta(2m)}{4^m(4^m+2)}\right|<4\cdot 10^{-6}.\tag{4}$$