Wednesday, November 30, 2016

[mvtobfjv] Memorizing the best pi approximation

Memorize just that e^(pi*sqrt(163)) is almost a perfect cube, and its difference from a perfect cube is almost an integer.  The other constants can be derived.

First calculate the cube root of the "almost integer".  Note exp(x/3) = cbrt(e^x).

? exp(Pi*sqrt(163)/3)
640320.00000000060486373504901603947175

Then find the offset from the cube.  Note that many scientific calculators do not have enough internal precision to compute this correctly.

? exp(Pi*sqrt(163))-640320^3
743.99999999999925007258948526705708004

Then you have recovered the necessary ingredients for the formula, which yields 30 correct digits of pi.  One did not have to memorize 640320 or +744.

? \p50
   realprecision = 57 significant digits (50 digits displayed)
? log(640320^3+744)/sqrt(163)-Pi
2.23735150380481508416601318272292512584 E-31

A similar memorization: sqrt(58) ... perfect 4th power yields 18 digits.

We can get 46 digits with a little more work, memorizing 2*Pi*sqrt(163) and perfect square:

? exp(Pi*sqrt(163))
262537412640768743.99999999999925007259719818568888

? exp(Pi*2*sqrt(163))-262537412640768744^2
-393767.999999999836261355790597560029392

Note 393768/2 = 196884 is Monstrous Moonshine.  Skip the next 2 steps if one already found 640320 and 744 from above.

? sqrt(exp(Pi*2*sqrt(163))+393768)^(1/3)
640320.00000000060486373504901664915438949934751465

? sqrt(exp(Pi*2*sqrt(163))+393768)-640320^3
744.00000000000000000000000000031183868722255543956

? log((640320^3+744)^2-393768)/(2*sqrt(163))-Pi
-9.303470618546941055 E-47

Of course, it is a little bit silly to be using a high-precision value of pi to compute a lower-precision approximation of pi.  Furthermore, if one is memorizing a formula for pi, easiest would be to memorize 4 atan 1 which gives an infinite number of correct digits.

No comments :