Vladinaiv49.cin

From TORI
Jump to navigation Jump to search

//Vladinaiv49.cin is approximation of natural tetration, implemented in C++ as the Taylor expansion at zero with 50 terms.

//


// Copyleft 2008 by Dmitrii Kouznetsov

z_type naiv49(z_type z) // polynonial approximation of tetration
{ int K=51,k;
DB coef[51]={ 1.
, 1.091767351258322138
, 0.271483212901696469
, 0.212453248176258214
, 0.069540376139988952
, 0.044291952090474256
, 0.014736742096390039
, 0.008668781817225539
, 0.002796479398385586
, 0.001610631290584341
, 0.000489927231484419
, 0.000288181071154065
, 0.000080094612538551
, 0.000050291141793809
, 0.000012183790344901
, 0.000008665533667382
, 0.000001687782319318
, 0.000001493253248573
, 0.000000198760764204
, 0.000000260867356004
, 0.000000014709954143
, 0.000000046834497327
,-0.000000001549241666
, 0.000000008741510781
,-0.000000001125787310
, 0.000000001707959267
,-0.000000000377858315
, 0.000000000349577877
,-0.000000000105377012
, 0.000000000074590971
,-0.000000000027175982
, 0.000000000016460766
,-0.000000000006741873
, 0.000000000003725329
,-0.000000000001639087
, 0.000000000000858364
,-0.000000000000394374
, 0.000000000000200252
,-0.000000000000094420
, 0.000000000000047121
,-0.000000000000022563
, 0.000000000000011155
,-0.000000000000005391
, 0.000000000000002652
,-0.000000000000001289
, 0.000000000000000633
,-0.000000000000000309
, 0.000000000000000151
,-0.000000000000000074
, 0.000000000000000036
,-0.000000000000000018
};
z_type s=1.,t=z;
for(k=1;k<=49;k++) { s+=coef[k]*t; t*=z; } //only 49 terms are used
//for(k=1;k<=51;k++) { s+=coef[k]*t; t*=z; } // 51 terms are used
return s;
}

//

//