How many terms does it take in the expansion of arctan(x) to get pi to 10 decimal places?

2.9k Views Asked by At

I was trying to find a mathematical way to find out how exactly how many terms it takes, but I've no idea. I just know that it's a lot. Thank you!

1

There are 1 best solutions below

5
On

If you are using the Taylor expansion centered around $0$ of $\arctan x$, $$ x - \frac{x^3}{3} + \frac{x^5}{5} + \dots$$ then you'll see it is an alternating series if $x > 0$. To get $\pi$, you might compute $\arctan 1 = \frac{\pi}{4}$. So we want to compute the series $$ 1 - \frac{1}{3} + \frac{1}{5} + \ldots$$

In general, it is easy to understand the error from alternating series. The error is less than the first omitted term. And heuristically, you might expect the error to be about half of the first omitted term - although this is a weak heuristic.

So here, if you want the error to be correct up to 10 decimal places, then you want to find the first term less than $10^{-11}$. Unfortunately, this is about the $5\cdot 10^{10}$th term in the series, which makes this an impractical way to calculate $\pi$.


Bonus edit:

If you're a bit more clever, you might know that $\arctan \frac{1}{2} + \arctan \frac{1}{3} = \frac{\pi}{4}$ as well. These are also both alternating series, but now the errors are much better controlled. In particular, every four terms of the series will give another digit (or so) of accuracy. So using the first forty terms of these two series and adding them together will also give an approximation of $\pi$ accurate to at least ten decimal places.

You could go deeper. It also turns out that $$ 4\arctan\frac{1}{5} - \arctan\frac{1}{239} = \frac{\pi}{4},$$ which is nice in that three additional terms of the series gives 2 (or so) digits of accuracy. So computing the first 15 terms of these expansions and adding them together would also do. Formula of this sort are called "Machin-like formulae," named after John Machin, who first came across them.