# Sunem.cin

sunem.cin is the C++ code that evaluates SuNem, which is the superfunction for the Nemtsov function, constructed at zero; id est, SuNem approaches zero at infinity in the most of directions, except vicinity of the real axis.

## Code

/*
int NEMTSOVM=18;
DB APQ[18][9];
DB NEMTSOVp;
DB NEMTSOVq;
DB Xunity = 0.66402958486808;

z_type nem(z_type z){ return z + z*z*z*(NEMTSOVp+z*NEMTSOVq); } //new
*/

//#include "sunem.cin"

z_type nemF0(z_type z){ int m,n,k; z_type c[22],s; z_type L=log(-z); z_type x=sqrt(-.5/(NEMTSOVp*z));
int M=18; // this is maximal m for which APQ are calculated.
c[0]=-1; // Not used.
c[1]=APQ[1][0]; // id est, just -q/p
c[2]=APQ[2][1]*L;
for(m=3;m<M;m++){k=m/2; s=APQ[m][k]*L;
for(n=k-1;n>0;n--){ s+= APQ[m][n]; s*=L; }
c[m]=s+APQ[m][0];}
s=c[M-1]*x;
for(m=M-2;m>0;m--){ s+=c[m]; s*=x; }
return x*(1.+s);
}

z_type nemF(z_type z){ int n,N; DB x,y,r; z_type s;
x=Re(z); if(x<-180.) return nemF0(z);
r=abs(z-30.); if(r>190. && x<30.) return nemF0(z);
y=Im(z); if(r>190 && abs(y)>20) return nemF0(z);
N=int(x+181.);
s=nemF0(z-DB(N)); DO(n,N) s=nem(s); return s;}

//DB Xunity = 0.66402958486808;
z_type sunem(z_type z){ return nemF(z+Xunity); }

int nemtsovapq(DB p, DB q)
{
NEMTSOVp=p;
NEMTSOVq=q;
//
APQ[0][0]=1.;
//
#include "nemtsova18pq.txt"

printf("nemtsova18pq called with parameters %20.16lf %20.16lf\n",p,q);

DB x,y; int n;
x=.7; DO(n,50){ y=Re(nemF(x)); x+=(1.-y); printf("%20.16lf %20.16lf\n",x,y); }
Xunity=x;

printf("nemtsova18pq assigns Xunity = %20.16lf\n",Xunity);

// getchar();
// DO(n,21){ x=-1.+.1*n; y=Re(sunem(x)); printf("%10.2f %20.16lf\n",x,y);}
DO(n,21){ x=-1.+.1*n; y=Re(sunem(x)); printf("%10.2f %20.16lf\n",x,y);}
//getchar();
//
return 18;}