Artificial intelligent assistant

Infinite series for arctan of x this is a bit of a vague question so I won't be too surprised if I get vague responses. $$\tan^{-1}(x) = x - (x^3 / 3) + (x^5 / 5) - (x^7 / 7) + \cdots $$ ad infinitum I'm using this, where $x = (\sqrt{2} - 1)$ to calculate $\pi$, as $\pi = 8 \tan^{-1}(x)$ I have never really learnt about infinite series before, and obviously when I translate this into a python code, I can't use a range from $(0, \infty)$. So, my question is this; How do I/can I represent this idea in the form of a geometric series or is that the wrong way of going about it? Thanks.

You are only going to get an approximation good to some number of decimal places. If you use $N$ terms in the series, then the error is approximately the magnitude of the $N+1$th term. The question you must ask yourself is, if I want $M$ decimal places of accuracy, then how big must $N$ be?

Example: say you want $M=6$ places of accuracy. Then

$$\frac{(\sqrt{2}-1)^{2 N+1}}{2 N+1} < 10^{-6}$$

By trial and error, I get $N=6$. That means you only need $6$ terms in the series to get that level of accuracy.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 47061afd8cbb9caab546e583e2de1c82