Re: Obtaining More Decimal Digits (50g) Message #2 Posted by Gilles Carpentier on 1 Sept 2012, 5:12 a.m., in response to message #1 by Eddie W. Shore
Hi Eddy,
Interesting. Here is a program wich calcultate n digits of PI with the same idea using BMP (Plouffe) formula
«
-> n
«
0 @ initial Value of PI
n ALOG @ Number of digits to find
1 @ 16^k initial value = 16^0
0 '2+LOG(8*n)+n*LOG(16)' >NUM CEIL R>I FOR k @ Number of iteration
k 1. DISP @ Display iterations
OVER [ 120 151 47 ] k PEVAL * @ Nominator * n ALOG
OVER 16 * SWAP ROT @ 16^k and 16^(k+1) on the stack
[ 512 1024 712 194 15 ] k PEVAL * @ Denominator
IQUOT 4. ROLL + UNROT @ Integer quotient and add to ~PI
NEXT
DROP2
»
»
'nPi' STO
The idea is that if you expand Plouffe formula :
'(1/(16^k))*((((4/((8*k)+1))-(2/((8*k)+4)))-(1/((8*k)+5)))-(1/((8*k)+6)))' EVAL EXPAND
->
'(k^2*120+151*k+47)/((512*k^4+1024*k^3+712*k^2+194*k+15)*2^(4*k))'
500 nPi gives the 500 first décimal of PI in ~ 3mn on a real calc (few seconds with emu48)(the last 3 digits are wrong)
As you can see here, the BMP formula is very interesting to calculate the n'th dgit of PI in hexadecimal :
Calculate the 1 million PI hexa digit in UserRpl
Edited: 1 Sept 2012, 5:55 a.m.
|