/*************************************************************************************************************************************/ /* */ /* C A L C U L D E ' P I ' P A R L A F O R M U L E */ /* D ' O R D R E 5 ( " Q U I N T I Q U E " ) : */ /* */ /* */ /* Author of '$xtc/pi_quintique.01$c' : */ /* */ /* Jean-Francois COLONNA (LACTAMME, AAAAMMJJhhmmss). */ /* */ /*************************************************************************************************************************************/ #include "INCLUDES.01.I" /* Introduit le 20051116101907... */ extern double sqrt(); extern double pow(); #define UN 1.0 #define DEUX 2.0 #define CINQ 5.0 #define SIX 6.0 #define SEPT 7.0 #define ITER 2 main() { double k; double A_k_1=UN / DEUX; double A_k; double S_k_1=CINQ*(sqrt(CINQ) - DEUX); double S_k; double x,y,z; double pi; for (k=0 ; k<ITER ; k++) { x = (CINQ / S_k_1) - UN; y = EXP2(x - UN) + SEPT; z = pow((x*(y + sqrt(EXP2(y) - 4*EXP3(x)))/DEUX),UN/CINQ); S_k = EXP2(CINQ) / (EXP2(z + (x/z) + UN)*S_k_1); A_k = (EXP2(S_k_1)*A_k_1) - (pow(CINQ,k)*(((EXP2(S_k_1) - CINQ)/DEUX) + sqrt(S_k_1*(EXP2(S_k_1) - (DEUX*S_k_1) + CINQ)))); A_k_1 = A_k; S_k_1 = S_k; /* Formule donnee a la page 624 de "PI a Source Book" des freres Borwein. */ } pi = UN / A_k; printf("\n pi = %.12f",pi); }