File:AfacmapT800.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.03 MB, MIME type: image/png)

Complex map of ArcFactorial

C++ generator of curves

fac.cin

// The code below should be stored as 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);}

afacc.cin

// The code below should be stored as afacc.cin

z_type afacb(z_type z){
DB z0=0.461632144968362341262659542325721328468196204;
DB F0=-0.12148629053584960809551455717769158215135617313;
DB c2=.483836122723810585213722380854825370205628608;
DB p=0.2090973242496979633924701135209125815611056;
DB q=0.0565790271828431799463572817754001404669620;
DB A=0.0008685913050832152753870514845664790993724;
DB B=0.0002046727298252365296379380008904113017495;
z_type t=(log(z)-F0)/c2;   z_type v=sqrt(t);
z_type u=v*(1.+v*(p+A*t))
         /(1.+v*(q+B*t)) + z0; return u;}
z_type afacc(z_type z){ z_type a,c,d;   a=afacb(z); 
d=facp(a); c=z-fac(a); a+=c/d; if(abs(c)<1.e-12) return a;
d=facp(a); c=z-fac(a); a+=c/d; if(abs(c)<1.e-12) return a;
d=facp(a); c=z-fac(a); a+=c/d; if(abs(c)<1.e-12) return a;
d=facp(a); c=z-fac(a); a+=c/d; if(abs(c)<1.e-12) return a;
d=facp(a); c=z-fac(a); a+=c/d; return a;
}

afacmap.cin

Files fac.cin, afacc.cin above and ado.cin and conto.cin should be loaded in the working directory for compillation of the C++ code below:

#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=400,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("afacmap.eps","w");ado(o,402,402);
fprintf(o,"201 201 translate\n 20 20 scale\n");
DO(m,M1) X[m]=-8.+.04*(m);
DO(n,200)Y[n]=-8.+.04*n;
        Y[200]=-.01;
        Y[201]= .01;
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>-6.9 && p<6.9 &&
//       (fabs(y)>.034 ||x>-.9 ||fabs(x-int(x))>1.e-3) &&
          q>-6.9 && q<6.9 //&& 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=.4;q=.4;
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<4;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<5;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<5;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.  ),-p,p); fprintf(o,".07 W .6 0 .6 RGB S\n");
for(m=-4;m<7;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;
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 afacmap.eps"); 
       system(    "open afacmap.pdf"); //for LINUX
//     getchar(); system("killall Preview");//for mac
}

Latex generator of labels

% File afacmap.pdf should be generated with the code above in order to compile the Latex document below:

% %<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{afacmap}} %<br> \put(158,348){\rot{-73}\sx{1.5}{$q\!=\!1.2$}\ero} %<br> \put(102,346){\rot{-51}\sx{1.5}{$q\!=\!1.4$}\ero} %<br> \put( 61,313){\rot{-34}\sx{1.5}{$q\!=\!1.6$}\ero} %<br> \put( 38,268){\rot{-16}\sx{1.5}{$q\!=\!1.8$}\ero} %<br> \put( 32,236){\rot{ -2}\sx{1.5}{$q\!=\!2$}\ero} %<br> \put( 32,188){\sx{1.8}{\bf cut}} %<br> \put( 33,152){\sx{1.5}{$q\!=\!-2$}} %<br> \put( 36,106){\rot{15}\sx{1.5}{$q\!=\!-1.8$}\ero} %<br> \put( 64, 60){\rot{35}\sx{1.5}{$q\!=\!-1.6$}\ero} %<br> \put(112, 33){\rot{53}\sx{1.5}{$q\!=\!-1.4$}\ero} %<br> \put(166, 27){\rot{74}\sx{1.5}{$q\!=\!-1.2$}\ero} %<br> % %<br> \put(225,308){\rot{82}\sx{1.5}{$q\!=\!1$}\ero} %<br> \put(219, 83){\rot{-87}\sx{1.5}{$q\!=\!-1$}\ero} %<br> \put(244, 89){\rot{-68}\sx{1.5}{$q\!=\!-0.8$}\ero} %<br> \put(253,293){\rot{62}\sx{1.5}{$q\!=\!0.8$}\ero} %<br> \put(280,276){\rot{45}\sx{1.5}{$q\!=\!0.6$}\ero} %<br> \put(300,250){\rot{30}\sx{1.5}{$q\!=\!0.4$}\ero} %<br> \put(298,226){\rot{15}\sx{1.5}{$q\!=\!0.2$}\ero} %<br> \put(304,187){\sx{1.6}{$q$=0}} %<br> %\put(300,162){\rot{-15}\sx{1.5}{$q\!=\!-0.2$}\ero} %<br> \put(264,132){\rot{54}\sx{1.5}{$p$=2.8}\ero} %<br> \put(280,110){\rot{50}\sx{1.5}{$p$=3}\ero} %<br> \put(290, 70){\rot{44}\sx{1.5}{$p$=3.2}\ero} %<br> \put(300, 42){\rot{39}\sx{1.5}{$p$=3.4}\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.03 MB)Maintenance script (talk | contribs)Importing image file

The following 2 pages use this file:

Metadata