I would like to know how are approximations for \( \pi \) like \[ \frac{355}{113} \] computed.I tried to find some by guess and check and I came up with \[\frac{65888736958667}{20973036362107} \]( Yeah,it's very hard to memorize) but it's only accurate to 15 decimal digits.My method was to choose a random number for the denominator and multiply it by the value of \( \pi \) up to 20 digits to get the numerator.So,are there more efficient methods to compute approximations for \( \pi \)?Thanks for any answers in advance!

## Comments

Sort by:

TopNewestUsually fractional approximations of irrational numbers(\(e\),\(\sqrt(2)\)..) can be easily computed from their Continued Fraction representation.

For instance the constant \(e= [2;1,2,1,1,4,1,1,6,1,1,8,…]\)(AO03417) as you can see, follows a simple pattern in its continued fraction representation. By using this pattern we can easily compute more and more accurate convergents of \(e\).

Unfortunately the continued fraction representation of \(\pi= [3;7,15,1,292,1,1,1,2,1,3,1,…]\)(AO01203) contains seemingly random digits.

However it is possible to compute such convergents by first finding the decimal representation of \(\pi\) and then approximate the decimal using the continued fraction method .

To demonstrate, \(\pi\) to seven decimal places is:

\[\pi \approx 3.1415927\] Taking the reciprocal of \(0.1415927\) \[ \pi \approx 3+ {1\over\displaystyle 7.0625133}\] And repeating this over and over we get.. \[\pi \approx 3+ {1\over \displaystyle 7 + {1\over \displaystyle 15 + {1\over \displaystyle 1 + {1\over \displaystyle 293 + {1\over \displaystyle 10.320556}}}}}\] and so on.. If we truncate the fraction at \(15\) it gives the approximation \[\pi \approx 3+ {1\over \displaystyle 7 + {1\over \displaystyle 15 + 1}} = {3 + {16\over 113}} = {355\over 113}\]

Since python already implements the rational approximation algorithm in its fractions module , all we have to do is find a large string of \(\pi\)(I used the The Spigot Algorithm here) and use the .limit_denominator(x) method to find a rational approximation.

The code prints out a reasonable approximation \(\frac{2549491779}{811528438}\). – Thaddeus Abiy · 2 years, 10 months ago

Log in to reply

– Tan Li Xuan · 2 years, 10 months ago

Thanks!Log in to reply

– Max B · 2 years, 10 months ago

think of how it was invented.....Log in to reply

– Thaddeus Abiy · 2 years, 10 months ago

pi?or the method?Log in to reply