Pi hand calculation ramble (Blaugust #1)
So apparently there's a thing about making a blog post every day in August? We're a little unwell, but heck with it, why not.
One of our recurring preoccupations is arithmetic in different bases/radices. (Heck, there's a post from our old Livejournal arguing for base 6 in 2007.) Recently, we rewatched part of a stream vod of ours in which we were calculating the golden ratio using Fibonacci numbers in a bunch of bases, and we felt like we could do it better now than we did then...
...so we've been plotting. And scheming. And refining our strategies. Because we're aiming our sights on π.
Right now, our goal is to exceed two sexagesimal digits of precision, and it's looking like the easiest way to accomplish that is to use John Machin's 1706 formula - three terms in the Taylor series for arctan(1/5) and one in the series for arctan(1/239) is enough to greatly exceed our goals, and we've worked out a fairly simple sequence of steps that's detailed enough that we can be careful about it.
- Calculate 5 factorial to get 120. This serves three purposes: it lets us count to five (an important number in the following), it gives us an estimate of how many significant figures we need (double the number in this), and we can...
- Double this and subtract 1 to get 239.
- Calculate the first 5 powers of 5 by repeated multiplication.
- Calculate via multiplication 3*53 and 5*55.
- Calculate via division 1/5, 1/3*53, and 1/5*55.
- Starting with 1/5, subtract 1/3*53, then add 1/5*55. This is our approximation of arctan(1/5).
- Multiply arctan(1/5) by four (possibly by repeated doubling).
- Retrieve this base's version of 239, and calculate 1/239. This is our approximation of arctan(1/239) (yes, we only need the one term!).
- Take our calculation of 4*arctan(1/5) and subtract arctan(1/239). This should be π/4.
- Multiply the above by four (again, possibly by repeated doubling). This is our approximation of π.
In contrast to our Fibonacci experiments, this will have four divisions instead of one. However, it is all still doable, and if we remember to do the equivalent of casting out nines and elevens, we might even get the right answer!