Getting closer to $\pi$
A lovely curiosity came my way via @mikeandallie and @divbyzero:
In 1992 Daniel Shanks observed that if p~pi to n digits, then p+sin(p)~pi to 3n digits. For instance, 3.14+sin(3.14)=3.1415926529…
— Dave Richeson (@divbyzero) July 15, 2016
Isn’t that neat? If I use an estimate $p = 3.142$, then this method gives $\pi \approx p + \sin(p) = 3.141\ 592\ 653\ 6$, which is off by about $10^{-12}$ – even better than Shanks suggests.
So, why does it work?
It’s a two-step chain of reasoning: a trig identity and a Maclaurin series.
The trig identity is that $\sin(\pi - p) = \sin(p)$, by symmetry. We’ve picked $p$ so that $\pi - p$ is small – in fact, smaller than $5 \times 10^{-n-1}$.
When an angle $x$ is small, $\sin(x)$ can be approximated as $\sin(x) \approx x - \frac 13 x^3$. In particular, $\sin(p) = \sin(\pi - p) \approx (\pi-p) - \frac 13 (\pi - p)^3 $.
Looking at Shanks’s original setup, we have $p + \sin(p) \approx p + (\pi - p) - \frac 13 (\pi - p)^3$, which simplifies to $\pi - \frac13 (\pi - p)^3$.
We know that $\pi - p$ is at most $5 \times 10^{-n-1}$, so $\left|\frac 13 (\pi - p)^3 \right| \lt \frac {125}{3} \times 10^{-3n - 3} < 5\times 10^{-3n-2} $. I reckon the approximation is generally correct to $3n+1$ decimal places ((Perhaps this breaks down in some cases when p’s last digit is 4 or 5, but that is left as an exercise.)).