Tet2.cin

From TORI
Jump to navigation Jump to search

// Tet2.cin is implementation of z_type Tet2(z_type z)

/* header suggested:
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define DB double
#define DO(x,y) for(x=0;x<y;x++)
#include <complex>
#define z_type std::complex<double>
#define Re(x) x.real()
#define Im(x) x.imag()
#define I z_type(0.,1.)
//#include "tet2f4c.cin"
#include "../conto.cin"
*/
// Tet2 begin

z_type Tet2u(z_type z){ z_type c,e;
z_type L = z_type(0.8246785461420740,1.5674321238496474);
z_type k=log(log(2.)*L);
z_type zK=z_type(1.23806941407137, 1.24816132484493), q=z_type(.106,-.0150);
e=exp(k*(z-zK));
c=e*(1.
+e*(z_type(-0.1088521804481237,-0.2760741919280730)
+e*(z_type(-0.0494617913252961, 0.0700910465136069)
+e*(z_type( 0.0240455559146310,-0.0029327488470335)
+e*(z_type(-0.0054746528127753,-0.0035758237661136)
+e*(z_type( 0.0005638677469377, 0.0014894502651636)
 ))) )))
;
c+=q*exp(2.*M_PI*I*z)*e;
return c+L;
}
//#include "Tet2u.cin"

z_type Tet2Li3(z_type z){ int n; z_type s,c; 
z_type L4c[101]=
{z_type(-0.96442197143292163, 0.05583913456798329),z_type(-0.44386570464167646, 1.51106601107493432)
,z_type(-0.52039308389402539, 0.15450254330734406),z_type(-0.62355791508386527, 0.17862280636827535)
,z_type(-0.71926217937183412,-0.57516849053290331),z_type( 0.05749830306418217,-0.82994217925992275)
,z_type( 0.43105359157262174,-0.49348248684090301),z_type( 0.64982487652611143,-0.20197590071626564)
,z_type( 0.63428645257823568, 0.32777473947912916),z_type( 0.19066098117240221, 0.59716413625540921)
,z_type(-0.16929224200198975, 0.51191304596747855),z_type(-0.43277756099569964, 0.31015093384750825)
,z_type(-0.50803880616233599,-0.06382362922870075),z_type(-0.29243448199504934,-0.33099175914462525)
,z_type(-0.04064936446829150,-0.38690390935293639),z_type( 0.19555514821283981,-0.31920326250291897)
,z_type( 0.32894214135024552,-0.09828120884621465),z_type( 0.26944910286553658, 0.11177913048912366)
,z_type( 0.13954393438926971, 0.21971021918723688),z_type(-0.02581292789333949, 0.24438102847859960)
,z_type(-0.15936450902190646, 0.14745186185612344),z_type(-0.18185161411949777, 0.01742769092611251)
,z_type(-0.14377642294507287,-0.08134062483323933),z_type(-0.05501982590348137,-0.14271190932093702)
,z_type( 0.04315099336263601,-0.12322960204752699),z_type( 0.08972837022303276,-0.06328369280246879)
,z_type( 0.10076073895258324, 0.00047998410103517),z_type( 0.06898847578276167, 0.05927724361718365)
,z_type( 0.01332972341490650, 0.07398840735627932),z_type(-0.02570068625604698, 0.05869216497883219)
,z_type(-0.05172097161127105, 0.02941268881794933),z_type(-0.05080229143069231,-0.01037506714434418)
,z_type(-0.02757901334921590,-0.03133987854930548),z_type(-0.00546322938165580,-0.03627631473049315)
,z_type( 0.01715705125867679,-0.02946263734365678),z_type( 0.02688849312920095,-0.00897449272218340)
,z_type( 0.02173617811106088, 0.00612384503350845),z_type( 0.01369861764416750, 0.01561347372318526)
,z_type(-0.00003287868453682, 0.01891860379000663),z_type(-0.00962025062651870, 0.01131331623919105)
,z_type(-0.01142748605738148, 0.00393921956696400),z_type(-0.01118815977860720,-0.00326985485593909)
,z_type(-0.00502464629123980,-0.00876059458746675),z_type( 0.00094985791374801,-0.00740625009361331)
,z_type( 0.00373694125378012,-0.00536076276373415),z_type( 0.00622462027483341,-0.00168500536017759)
,z_type( 0.00442989747969840, 0.00258176966491394),z_type( 0.00176631559869888, 0.00319518970415377)
,z_type( 0.00007310635245690, 0.00362370309322360),z_type(-0.00245512873560677, 0.00245365498295746)
,z_type(-0.00243221602224390, 0.00002011548331446),z_type(-0.00169901290818137,-0.00063485732558974)
,z_type(-0.00118336233167492,-0.00167997624232268),z_type( 0.00052458682611526,-0.00170092415011180)
,z_type( 0.00086976653179552,-0.00059357465758510),z_type( 0.00091036532311980,-0.00038024421570873)
,z_type( 0.00105850512096046, 0.00048113979927880),z_type( 0.00012602042659601, 0.00083174033478296)
,z_type(-0.00008622246594299, 0.00040931639700827),z_type(-0.00027812449828624, 0.00053242098053083)
,z_type(-0.00063587568461917, 0.00001609634833726),z_type(-0.00018253901941825,-0.00029001257366755)
,z_type(-0.00015506695295160,-0.00012828934236503),z_type(-0.00002996351748379,-0.00038054789615742)
,z_type( 0.00030231236254942,-0.00012182090022998),z_type( 0.00007763375454987, 0.00005743328041207)
,z_type( 0.00015169602237680,-0.00003887561095912),z_type( 0.00011353137812138, 0.00020757465003278)
,z_type(-0.00012474003847589, 0.00008616891475390),z_type( 0.00001041542798485, 0.00000316351490342)
,z_type(-0.00008801761239733, 0.00009255810050519),z_type(-0.00009916071506107,-0.00009795531452574)
,z_type( 0.00005462958189017,-0.00003408399422652),z_type(-0.00004733337061949,-0.00000055466895962)
,z_type( 0.00003724277408065,-0.00008661168938259),z_type( 0.00006358679057164, 0.00004652159392422)
,z_type(-0.00003443377146479, 0.00000305632800170),z_type( 0.00004987251922054,-0.00001172281172453)
,z_type(-0.00001163567858825, 0.00006326592250238),z_type(-0.00003603332203559,-0.00002736506629286)
,z_type( 0.00002968990404160, 0.00000786644656885),z_type(-0.00003926188226218, 0.00001762032044778)
,z_type( 0.00000282992874630,-0.00004221696016455),z_type( 0.00002071301987636, 0.00002080964719940)
,z_type(-0.00002648997970265,-0.00000862292494458),z_type( 0.00002768773458769,-0.00001699850316945)
,z_type(-0.00000118908087485, 0.00002800804015221),z_type(-0.00001316792012014,-0.00001748225342134)
,z_type( 0.00002229027261526, 0.00000638281027493),z_type(-0.00001925760751739, 0.00001402286912933)
,z_type( 0.00000177825673539,-0.00001855855520970),z_type( 0.00000924387242742, 0.00001435275174947)
,z_type(-0.00001671687638994,-0.00000479140314426),z_type( 0.00001233435793512,-0.00001105497404848)
,z_type(-0.00000151922074091, 0.00001363774455698),z_type(-0.00000624952168421,-0.00001038808853014)
,z_type( 0.00001390188179944, 0.00000223388551343),z_type(-0.00001256467584753, 0.00000584236963269)
,z_type(-0.00000029067672508,-0.00001118872850170),z_type( 0.00000228471905911, 0.00000491389003744)
,z_type(-0.00001047526247999, 0.00000020892389615) };
c=z-3.*I; c/=4.; s=L4c[90]*c; for(n=89;n>0;n--){ s+=L4c[n]; s*=c;}
return log(z+2.)/log(2.)+L4c[0]+s;}
//#include "Tet2Li3.cin"

z_type Tet2Lo(z_type z){ int n; z_type s,c; 
z_type L3c[101]=
{-0.0000000000000000, 0.5040523025294840, 1.7011208616884124, 0.9484156810298234
, 1.3599706793748789, 0.9597863375189202, 1.1379461914980471, 0.8454857420696456
, 0.9256660533674120, 0.6920044206804450, 0.7295944645732604, 0.5388526805778043
, 0.5595823551251433, 0.4036680378201167, 0.4196664681013035, 0.2925869854682322
, 0.3091607912123628, 0.2057174755131016, 0.2247021550616910, 0.1402973810988637
, 0.1618468781449393, 0.0925219658067981, 0.1160777259887314, 0.0585410461363722
, 0.0833392329781741, 0.0349397819886780, 0.0602552895072349, 0.0189135737409261
, 0.0441579337550952, 0.0082760455207704, 0.0330189368563712, 0.0013875044482174
, 0.0253424168568381,-0.0029447469469519, 0.0200518108870180,-0.0055666625314999
, 0.0163878639915662,-0.0070654495857441, 0.0138241061281823,-0.0078410084274333
, 0.0120006428784789,-0.0081609769578880, 0.0106743530459552,-0.0082015471339406
, 0.0096825760443401,-0.0080768390871197, 0.0089172869544937,-0.0078595312451452
, 0.0083071036013318,-0.0075950542526024, 0.0078049649460875,-0.0073111837924319
, 0.0073798162620565,-0.0070244214902706, 0.0070110682300393,-0.0067441781009384
, 0.0066849439169365,-0.0064754787529173, 0.0063920920241296,-0.0062206894290743
, 0.0061260388725098,-0.0059806042189772, 0.0058821899783890,-0.0057551204612134
, 0.0056571884330020,-0.0055436514459758, 0.0054485031450345,-0.0053453740198180
, 0.0052541642447374,-0.0051593735993660, 0.0050725922656109,-0.0049847263120151
, 0.0049024869330310,-0.0048205431298733, 0.0047427538178017,-0.0046659915166586
, 0.0045924550712121,-0.0045203040202391, 0.0044507755931624,-0.0043827795915846
, 0.0043169991643768,-0.0042527810276816, 0.0041904910771679,-0.0041297305343013
, 0.0040706851022180,-0.0040131046150961, 0.0039570734981819,-0.0039024287924408
, 0.0038491989203031,-0.0037972726238033, 0.0037466480837278,-0.0036972450934507
, 0.0036490462706721,-0.0036019904616736, 0.0035560528316969,-0.0035111844524143
, 0.0034673574473643,-0.0034245309682877, 0.0033826766832423,-0.0033417592872837
, 0.0033017511631726 };
c=z/3.; s=L3c[90]*c; for(n=89;n>0;n--){ s+=L3c[n]; s*=c;}
return log(z+2.)/log(2.)+L3c[0]+s;}
//#include "Tet2Lo.cin"

z_type Tet2(z_type z){ 
DB x=Re(z); 
DB y=Im(z);
z_type L=z_type(0.8246785461420740,1.5674321238496474);
z_type KL=log(log(2.)*L);
if(x*x+y*y<4.) return Tet2Lo(z);
if(y<0) return conj(Tet2(conj(z)));
if(y>4. && y > 4.7 + x * (Re(KL)/Im(KL)) )  return Tet2u(z);
if(x>1.) return exp(log(2.)*Tet2(z-1.));
if(x<-1.) return log(Tet2(z+1.))/log(2.);
return Tet2Li3(z);
}

/*

Description

Implementation of Tet2 is constructed as combination of already implemented Tet2u, Tet2Li and Tet2Lo, see Tet2u.cin, Tet2Li3.cin and Tet2Lo.cin.

References

Keywords

Ackermann, Approximation, C++, Superfunction, Tet2, Tetration to base 2

  • /