Fslog.cin

From TORI
Jump to: navigation, search
// ArcTetration to base e:
// Complex double implementation of function ate in C++.
// Precision: 14 correct decimal digits are expected in the output.
// To call this function at complex argument z, type FSLOG(z) 
// Copyleft 2009-2011 by Dmitrii Kouznetsov.
// The free use is allowed. At the redistribution, 
// indicate this license and attribute the source:
// http://mizugadro.mydns.jp/t/index.php/Fslog.cin
z_type L=z_type(0.3181315052047641353,1.337235701430689409);
z_type Zo=z_type(.31813150520476413, 1.3372357014306895);
z_type Zc=z_type(.31813150520476413,-1.3372357014306895);
DB DE[128]={
1.4192252155045112363
,-0.05213258059503801667
, 0.00693219127232187586
,-0.00015617045803377859
,-0.00100912103192385785
, 0.00082172671942507903
,-0.00035776641706493177
,-0.00000931803078422933
, 0.00016678111348857047
,-0.00014181446429806932
, 0.00003186488716454018
, 0.00006022937595596333
,-0.00007769822429012910
, 0.00002881816919640196
, 0.00003346765914794806
,-0.00005635940084759932
, 0.00002613708927959275
, 0.00002533341053138444
,-0.00005010441151688034
, 0.00002593810263640952
, 0.00002404611936084357
,-0.00005163238246428602
, 0.00002794638872473000
, 0.00002700739592764804
,-0.00005939035114511979
, 0.00003210955504312860
, 0.00003438232223525011
,-0.00007428278434380886
, 0.00003866302665809861
, 0.00004803799918127077
,-0.00009914141292927652
, 0.00004800025436154043
, 0.00007191960183392704
,-0.00013922522917537457
, 0.00006043126908005670
, 0.00011338211995240744
,-0.00020351111316586852
, 0.00007562971718596908
, 0.00018585637209671475
,-0.00030700846364341576
, 0.00009132512919756623
, 0.00031386108850653502
,-0.00047464470561729965
, 0.00010030770871287629
, 0.00054232170050706079
,-0.00074759603610534669
, 0.00008375204845585605
, 0.00095389423083896800
,-0.00119336225449479362
,-0.00000327383738614825
, 0.00170107934819055851
,-0.00192109516273315209
,-0.00026290310001950487
, 0.00306590657916818192
,-0.00310372506294090238
,-0.00091982425407694250
, 0.00556979490215834833
,-0.00500546835451257978
,-0.00245869651201214212
, 0.01017705593773498771
,-0.00800820238034244403
,-0.00590649361431362999
, 0.01866321477729812259
,-0.01260156096677063874
,-0.01341963601206602220
, 0.03429254345271898208
,-0.01926894593144593687
,-0.02946277663641767158
, 0.06300065960337521143
,-0.02800532706641396460
,-0.06325609033757989552
, 0.11556117355587923468
,-0.03708367328869965895
,-0.13352664223772733876
, 0.21104853030721187901
,-0.03941069742436464907
,-0.27853504829255953945
, 0.38331715278474703945
,-0.01491397058539710788
,-0.57446133459038406510
, 0.68905734940479856920
, 0.09065013779953061401
,-1.17542205931169707611
, 1.22536662105515059551
, 0.40500835675024698945
,-2.37977019901803332758
, 2.13411821810153146117
, 1.24184396615612624437
,-4.78947531960227212977
, 3.64093109251482172084
, 3.27095016057312193425
,-9.53051815711462246838
, 5.92750355113636295812
, 8.12068845726284394004
,-18.89123486907114468636
, 9.07245090167984002960
,18.99435214920948311601
,-36.62201395750987842348
,12.69160696640316032813
,43.73569046442687380249
,-71.43155879446639744401
,14.83661067193675719977
,95.94011857707508283966
,-135.28537549407113260713
, 4.55415019762845751927
,212.46383399209483400227
,-258.45286561264816782568
,-34.35533596837944259050
,440.37608695652170354151
,-466.49328063241102881875
,-184.78893280632408391284
,969.10988142292478642048
,-888.80079051383393107244
,-485.21897233201576682404
,1912.15652173913008482486
,-1381.80553359683767666866
,-1490.15335968379417863616
,4216.82213438735107047250
,-2565.99525691699591334327
,-3155.47826086956501967506
,7689.57470355731129529886
,-3206.47588932806274897303
,-8547.41501976284416741692
,17971.70592885375299374573
,-7203.41501976284507691162
,-16388.65454545454485923983
,28589.12885375493715400808
,-2355.80711462450562976301
};
z_type slo(z_type z1){ int K=128,k;
z_type z=z1-1.;  z/=2.;
z_type s=0.; //z_type t=1; 
for(k=K-1;k>0;k--){ s+=DE[k]; s*=z; }
s+=DE[0];
s+=log(z1-Zo)/Zo+log(z1-Zc)/Zc;
return s;
}
z_type FSLOG(z_type z1){ DB x=Re(z1),  y=Im(z1);
if(fabs(y)>fabs(Im(Zo)) ) return FSLOG(log(z1))+1.;
if(x	  <     Re(Zo)  ) return FSLOG(exp(z1))-1.;
if(x>2) return FSLOG(log(z1))+1.;
z_type z=z1-1.;
z_type LZ=log(z1); if( abs(LZ-1.)<   abs(z) ) return FSLOG(LZ)+1.;
//z_type EZ=exp(z1); if( abs(EZ-1.)<.1*abs(z) ) return FSLOG(EZ)-1.;
return slo(z1);
}

/*

  • /