Sutran.cin

From TORI
Jump to: navigation, search

// sutran.cin is the complex(double) C++ implementation of function SuTra, which is superfunction of the Trappmann function $\mathrm{tra}(z)=z+\exp(z)$. // This implementation is simpler, faster and more precise that sutra.cin, that evaluates the same function SuTra through function SuZex // sutran(z) returns value $\mathrm{SuTra}(z)$ with at least 14 decimal digits, except vicinity of the positive part of the real axis, where the function shows very fast growth (similar to that of tetration) and very fast and strong oscillations.


/*
#define DB double
#define DO(x,y) for(x=0;x<y;x++)
using namespace std;
#include<complex>
typedef complex<double> z_type;
#define Re(x) x.real()
#define Im(x) x.imag()
#define I z_type(0.,1.)
#include "conto.cin"
// #include "SuZex.cin"
*/

z_type tra(z_type z) {return z+exp(z);}

//z_type sutra(z_type z){ if( Re(z)<2. ) return log(suzex(z));
// return tra(sutra(z-1.));}
//old

// Warning! A is global array (to print tables)
DB A[12][12]={{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, -0.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{.16666666666666666,-.25, 0.125, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{.14583333333333334,-.2916666666666667, .1875, -0.041666666666666664, 0, 0, 0, 0, 0, 0, 0, 0},
{.14976851851851852,-.3645833333333333, .3125, -0.11458333333333333, 0.015625, 0, 0, 0, 0, 0, 0, 0},
{.16516203703703702,-.48182870370370373,.5208333333333334, -0.265625, 0.06510416666666667, -0.00625, 0, 0, 0, 0, 0, 0},
{.19026441247795414,-.6538194444444444, .8627025462962963,-.5668402777777778,.19856770833333334,-.03567708333333333,.0026041666666666665,0,0,0,0,0},
{.22588548555996474,-.8977029596560847,1.4120804398148148,-1.1461226851851851,.5244140625,-.13697916666666668,.019140625,-.0011160714285714285,0,0,0,0},
{.2753440585982335, -1.239450679287919,2.2770203993055556,-2.2204885223765434,1.265064380787037,-.43557942708333336,.08947482638888889,
   -.010128348214285715, 0.00048828125, 0, 0, 0},
{.34496713297587556,-1.7211015740368936,3.6174115582286155,-4.146271460262346,2.8530207127700615,-1.2298412181712963,.3351236979166667,
    -.05619264632936508, 0.005308314732142857, -0.00021701388888888888, 0, 0},
{.4437001055047508, -2.4129028854098866,5.6811843206973185,-7.499253067474096,6.09106574918017,-3.1826392505787036,1.0899427625868054,
    -0.2435329861111111, 0.03426252092633929, -0.002762664310515873, 0.00009765625, 0},
{.5803465848040893, -3.4249519702286975,8.872849373873375,-13.218267068232578,12.419599208932706,-7.682385374469521,3.1971707567756558,
    -0.9002970377604167, 0.1693393767826141, -0.020416066003224206, 0.0014301602802579364, -0.00004438920454545455}};

z_type sutra0(z_type z){ z+=-1.1259817765745026;
 z_type L=log(-z); z_type s,w, t=1./z;
 int M=11; // WARNING!! at TORI, M=11
 z_type c[12]; int m,n;
 for(m=1;m<=M;m++){ w=A[m][m]; for(n=m-1; n>=0; n--) {w*=L; w+=A[m][n]; }
                    c[m]=w;}
 s=c[M]*t; for(m=M-1;m>0;m--){ s+=c[m]; s*=t;} return -L+s;
}

z_type sutran(z_type z) { DB x=Re(z); if(x<-10.) return sutra0(z); DB y=Im(z);
 if( fabs(y)<6.){int n,m; n=int(x+12.); z_type c=sutra0(z-(0.+n)); DO(m,n) c=tra(c); return c;}
 DB x0=x-5.; if(x0*x0+y*y >289.) return sutra0(z);
 return tra(sutran(z-1.));
}

//

/*

  • /