File:FacmapT500.png

From TORI
Revision as of 09:41, 21 June 2013 by Maintenance script (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Original file(2,355 × 2,334 pixels, file size: 1.73 MB, MIME type: image/png)

Complex map of Factorial

C++ Generator of curves

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

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#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 "fac.cin"
//#include "sinc.cin"
#include "facp.cin"
#include "afacc.cin"
//#include "superfac.cin"
#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<N1;n++) Y[n]=-8.+.04*(n-1.); 
for(m=-8;m<9;m++){if(m==0){M(m,-8.5)L(m,8.5)} else{M(m,-8)L(m,8)}}
for(n=-8;n<9;n++){     M(  -8,n)L(8,n)}
fprintf(o,".008 W 0 0 0 RGB S\n");
DO(m,M1)DO(n,N1){g[m*N1+n]=9999; f[m*N1+n]=9999;}
DO(m,M1){x=X[m]; //printf("%5.2f\n",x);
DO(n,N1){y=Y[n]; z=z_type(x,y);         
//     c=afacc(z);
       c=fac(z);
//     c=superfac(z);
//     p=abs(c-d)/(abs(c)+abs(d));  p=-log(p)/log(10.)-1.;
       p=Re(c);q=Im(c);        
       if(p>-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

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

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current17:50, 20 June 2013Thumbnail for version as of 17:50, 20 June 20132,355 × 2,334 (1.73 MB)Maintenance script (talk | contribs)Importing image file

There are no pages that use this file.

Metadata