Sune.cin

From TORI
Jump to navigation Jump to search

/* Sune.cin is the C++ routine for evaluation of the superfunction of the Nemtsov function. File sunema.txt (or sunemco.txt ) should be loaded too.*/

//


//Q should be global variable, and array A[][] too.

// DB Q=2.;
// z_type nem(z_type z){ return z*(1.+z*z*(1.+z*Q)); }
// z_type nem1(z_type z){ return 1.+z*z*(3.+z*(4.*Q)); } // WARNING: Q is global!

DB K=Q*Q;
DB A[37][19];
int co(){
//#include "sunema.txt" //Supposed to be the same..
#include "sunemco.txt"

return 0;}

z_type sun(z_type z){ z_type p[37],s; int m,M,n,N;
z_type L=log(-z);
z_type t=1./sqrt(-2.*z);
M=36;
for(m=2;m<M+1;m++){ N=m/2; s=A[m][N]*L; for(n=N-1;n>0;n--) { s+=A[m][n]; s*=L; }
                p[m]=A[m][0]+s;
                }
s=p[M]*t; for(m=M-1; m>1;m--) { s+=p[m]; s*=t;}
        return t*( 1. + t* (-Q + s) );
}

z_type sune(z_type z){ int m,n; DB x,y; z_type s;
DB R=20.+20.*Q*Q;
x=Re(z); if(x<-R) return sun(z);
y=Im(z); if(fabs(y)>R) return sun(z);
n=int(x+R);
s=sun(z-(0.+n));
DO(m,n) s=nem(s);
return s;
}

//

/* */