File:FacmapT500.png

Complex map of Factorial

fac.cin
z_type fracti(z_type z){ z_type s; int n; DB a[17]= {0.0833333333333333333, 0.0333333333333333333, .252380952380952381, .525606469002695418,  1.01152306812684171,   1.51747364915328740,   2.26948897420495996, 3.00991738325939817,  4.02688719234390123,   5.00276808075403005,   6.28391137081578218, 7.49591912238403393,  9.04066023436772670,  10.4893036545094823,   12.2971936103862059, 13.9828769539924302,  16.0535514167049355 }; s=a[16]/(z+19./(z+25./(z)));  for(n=15;n>=0;n--) s=a[n]/(z+s); return s + log(2.*M_PI)/2. - z + (z+.5)*log(z); } // logfactorial for large values of argument except vicinity of negative part of real axis)

z_type infac0(z_type z){ z_type s; int n; DB c[28]={ 1., 0.57721566490153286061,       -0.65587807152025388108, -0.042002635034095235529,        0.16653861138229148950, -0.042197734555544336748,       -0.0096219715278769735621,  0.0072189432466630995424,      -0.0011651675918590651121, -0.00021524167411495097282,      0.00012805028238811618615, -0.000020134854780788238656,    -0.0000012504934821426706573,  0.0000011330272319816958824,   -2.0563384169776071035e-7, 6.1160951044814158179e-9,      5.0020076444692229301e-9, -1.1812745704870201446e-9,      1.0434267116911005105e-10, 7.7822634399050712540e-12,    -3.6968056186422057082e-12, 5.1003702874544759790e-13,    -2.0583260535665067832e-14, -5.3481225394230179824e-15,     1.2267786282382607902e-15, -1.1812593016974587695e-16,     1.1866922547516003326e-18, 1.4123806553180317816e-18}; s=c[27]*z; for(n=26;n>0;n--) {s+=c[n]; s*=z;} s+=c[0]; return s;}

z_type fac0(z_type z){ return 1./infac0(z);}

z_type expaun(z_type z) {int n,m; DB x,y; x=Re(z);if(x<-.5) return expaun(z+1.)-log(z+1.); if(x>.6) return expaun(z-1.)+log(z); y=Im(z); if(fabs(y)>1.4)return expaun(z/2.)+expaun(z/2.-.5)+z*log(2.)-log(sqrt(M_PI)); return -log(infac0(z)); }

z_type lof(z_type z){DB x,y; x=Re(z); y=Im(z); if(fabs(y)>5. ) return fracti(z); if(x>0 && x*x+y*y>25.) return fracti(z); return expaun(z); } // lof(z) returns 16 digits of complex logfactorial.

z_type infac1(z_type z){return infac0(z/2.)*infac0((z-1.)/2.)*sqrt(M_PI)/exp(log(2.)*z);} z_type infac2(z_type z){return infac1(z/2.)*infac1((z-1.)/2.)*sqrt(M_PI)/exp(log(2.)*z);} z_type infac3(z_type z){return infac2(z/2.)*infac2((z-1.)/2.)*sqrt(M_PI)/exp(log(2.)*z);} z_type inhalf(z_type z){DB x=Re(z); DB y=Im(z); DB r=x*x+y*y; if(r<2.) return infac0(z); if(r<5.) return infac1(z); return infac2(z); }

z_type infacmi(z_type z){ if(Re(z)> 1.) return infacmi(z-1.)/z;    return inhalf(z);} z_type infaclu(z_type z){ if(Re(z)<-.5) return infaclu(z+1.)*(z+1.);return inhalf(z);}

z_type infac(z_type z){DB x=Re(z),y=Im(z),t=x*x+y*y; if(t<1.)return infac0(z); if( fabs(y)> 5. || (x>0 && t>25) )             return exp(-fracti(z)); if( x>0 ) return infacmi(z); return infaclu(z);}

z_type fac(z_type z){ DB x=Re(z),y=Im(z),t=x*x+y*y; if(t<2.)return 1./infac0(z); if( (x>0. && t>25.) || fabs(y)>5.)        return exp(fracti(z)); if(x>0) return 1./infacmi(z); return 1./infaclu(z);}

facmap.cc
// do not forget to load also conto.cin and ado.cin

using namespace std; typedef complex z_type; //#include "sinc.cin" //#include "superfac.cin"
 * 1) include 
 * 2) include 
 * 3) include 
 * 4) define DB double
 * 5) define DO(x,y) for(x=0;x<y;x++)
 * 1) include
 * 1) define Re(x) x.real
 * 2) define Im(x) x.imag
 * 3) define I z_type(0.,1.)
 * 4) include "fac.cin"
 * 1) include "facp.cin"
 * 2) include "afacc.cin"
 * 1) include "conto.cin"

main{ int j,k,m,n; DB x,y, p,q, t; z_type z,c,d; int M=403,M1=M+1; int N=401,N1=N+1; DB X[M1],Y[N1], g[M1*N1],f[M1*N1], w[M1*N1]; // w is working array. char v[M1*N1]; // v is working array // FILE *o;o=fopen("fig2b.eps","w");ado(o,402,402); FILE *o;o=fopen("facmap.eps","w");ado(o,402,402); fprintf(o,"201 201 translate\n 20 20 scale\n"); DO(m,212) X[m]=-8.+.04*(m); X[212]=.45; X[213]=.46; X[214]=.47; for(m=215;m<M1;m++) X[m]=-8.+.04*(m-3.); DO(n,200)Y[n]=-8.+.04*n; Y[200]=-.008; Y[201]= .008; for(n=202;n-9999 && p<9999 && //      (fabs(y)>.034 ||x>-.9 ||fabs(x-int(x))>1.e-3) &&           q>-9999 && q<9999 //&& fabs(q)> 1.e-19        ) {g[m*N1+n]=p;f[m*N1+n]=q;} }} //fprintf(o,"1 setlinejoin 2 setlinecap\n"); p=1.8;q=.7;

fprintf(o,"1 setlinejoin 1 setlinecap\n"); p=1.4;q=.8; for(m=-4;m<4;m++)for(n=2;n<10;n+=2)conto(o,f,w,v,X,Y,M,N,(m+.1*n),-q, q); fprintf(o,".025 W 0 .6 0 RGB S\n"); for(m=0;m<2;m++) for(n=2;n<10;n+=2)conto(o,g,w,v,X,Y,M,N,-(m+.1*n),-q, q); fprintf(o,".025 W .9 0 0 RGB S\n"); for(m=0;m<2;m++) for(n=2;n<10;n+=2)conto(o,g,w,v,X,Y,M,N, (m+.1*n),-q, q); fprintf(o,".025 W 0 0 .9 RGB S\n"); for(m=1;m<15;m++) conto(o,f,w,v,X,Y,M,N, (0.-m),-p,p); fprintf(o,".07 W .9 0 0 RGB S\n"); for(m=1;m<15;m++) conto(o,f,w,v,X,Y,M,N, (0.+m),-p,p); fprintf(o,".07 W 0 0 .9 RGB S\n"); conto(o,f,w,v,X,Y,M,N, (0. ),-9,9); fprintf(o,".07 W .6 0 .6 RGB S\n"); for(m=-14;m<0;m++) conto(o,g,w,v,X,Y,M,N, (0.+m),-p,p); fprintf(o,".07 W 0 0 0 RGB S\n"); m=0;    conto(o,g,w,v,X,Y,M,N, (0.+m),-9,9); fprintf(o,".07 W 0 0 0 RGB S\n"); for(m=1;m<17;m++) conto(o,g,w,v,X,Y,M,N, (0.+m),-p,p); fprintf(o,".07 W 0 0 0 RGB S\n"); //#include"plofu.cin" x=0.8856031944; conto(o,g,w,v,X,Y,M,N,0.8856031944,-p,p); fprintf(o,".02 W .5 .5 0 RGB S\n"); /* M(x,-8)L(x,8) fprintf(o,"0 setlinejoin 0 setlinecap 0.004 W 0 0 0 RGB S\n"); M(x,0)L(-8.1,0) fprintf(o,"                  .05 W  1 1 1 RGB S\n"); DO(m,23){ M(x-.4*m,0)L(x-.4*(m+.5),0);} fprintf(o,".09 W .3 .3 0 RGB S\n"); //M(x,0)L(-8.1,0) fprintf(o,"[.19 .21]0 setdash .05 W 0 0 0 RGB S\n"); // May it be, that, some printers do not interpret well the dashing ? */ fprintf(o,"showpage\n%c%cTrailer",'%','%'); fclose(o); system("epstopdf facmap.eps"); system(   "open facmap.pdf");  //for LINUX //    getchar; system("killall Preview");//for mac }

Latex generator of labels
% % \documentclass[12pt]{article} % \usepackage{geometry} % \usepackage{graphicx} % \usepackage{rotating} % \usepackage{hyperref} % \paperwidth 339px % \paperheight 336px % \textwidth 165mm % \textheight 240mm % \topmargin -96pt % \oddsidemargin -76pt % \parindent 0pt % \begin {document} % \newcommand \sx {\scalebox} % \newcommand \rme 	 % \newcommand \rmi 	%imaginary unity is always roman font % \newcommand \ds {\displaystyle} % \newcommand \bN {\mathbb{N}} % \newcommand \bC {\mathbb{C}} % \newcommand \bR {\mathbb{R}} % \newcommand \cO {\mathcal{O}} % \newcommand \cF {\mathcal{F}} % \newcommand \rot {\begin{rotate}} % \newcommand \ero {\end{rotate}} % \newcommand \nS {\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!} % \newcommand \pS {{~}~{~}} % \newcommand \fac {\mathrm{Factorial}} % \newcommand \ax { % \put( 10,342){\sx{1.4}{$y$}} % \put( 10,307){\sx{1.3}{$6$}} % \put( 10,267){\sx{1.3}{$4$}} % \put( 10,227){\sx{1.3}{$2$}} % \put( 10,187){\sx{1.3}{$0$}} % \put( 0,147){\sx{1.3}{$-2$}} % \put( 0,107){\sx{1.3}{$-4$}} % \put( 0, 67){\sx{1.3}{$-6$}} % \put( 0, 27){\sx{1.3}{$-8$}} % \put( 50, 18){\sx{1.3}{$-6$}} % \put( 90, 18){\sx{1.3}{$-4$}} % \put(130, 18){\sx{1.3}{$-2$}} % \put(178, 18){\sx{1.3}{$0$}} % \put(218, 18){\sx{1.3}{$2$}} % \put(258, 18){\sx{1.3}{$4$}} % \put(298, 18){\sx{1.3}{$6$}} % \put(334, 19){\sx{1.4}{$x$}} % } % \begin{picture}(340,340) \ax % \put(-20,-10){\includegraphics{facmap}} % %\put(266,246){\rot{-14}\sx{1.6}{$u\!=\!0$}\ero} % \put(286,225){\rot{-7}\sx{1.6}{$v\!=\!0$}\ero} % \put(288,207){\rot{-5}\sx{1.6}{$u\!=\!0$}\ero} % \put(299,187){\sx{1.6}{$v\!=\!0$}} % \put(288,168){\rot{5}\sx{1.6}{$u\!=\!0$}\ero} % \put(286,150){\rot{7}\sx{1.6}{$v\!=\!0$}\ero} % % % \put(103,100){\rot{54}\sx{1.6}{$u\!=\!0$}\ero} % \put(117,100){\rot{53}\sx{1.6}{$v\!=\!0$}\ero} % \put(135,100){\rot{54}\sx{1.6}{$u\!=\!0$}\ero} % \put(152,100){\rot{54}\sx{1.6}{$v\!=\!0$}\ero} % \put(167, 99){\rot{50}\sx{1.6}{$u\!=\!0$}\ero} % \put(182, 95){\rot{41}\sx{1.6}{$v\!=\!0$}\ero} % \put(194, 85){\rot{39}\sx{1.6}{$u\!=\!0$}\ero} % \put(201, 73){\rot{35}\sx{1.6}{$v\!=\!0$}\ero} % \put(208, 61){\rot{33}\sx{1.6}{$u\!=\!0$}\ero} % \put(215, 49){\rot{28}\sx{1.6}{$v\!=\!0$}\ero} % \end{picture} % \end{document} % %