From Citizendium, the Citizens' Compendium
Jump to: navigation, search

//Sourse that draws figure

// TetrationAsymptoticParameters00.jpg
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define DB double
#include <complex.h>
#define z_type complex<double>
#define Re(x) x.real()
#define Im(x) x.imag()
#define I z_type(0.,1.)
void ado(FILE *O, int X, int Y)
{	fprintf(O,"%c!PS-Adobe-2.0 EPSF-2.0\n",'%');
	fprintf(O,"%c%cBoundingBox: 0 0 %d %d\n",'%','%',X,Y);
	fprintf(O,"/M {moveto} bind def\n");
	fprintf(O,"/L {lineto} bind def\n");
	fprintf(O,"/S {stroke} bind def\n");
	fprintf(O,"/s {show newpath} bind def\n");
	fprintf(O,"/C {closepath} bind def\n");
	fprintf(O,"/F {fill} bind def\n");
	fprintf(O,"/o {.6 0 360 arc C F} bind def\n");
	fprintf(O,"/O { 2 0 360 arc C S} bind def\n");
	fprintf(O,"/times-Roman findfont 6 scalefont setfont\n");
	fprintf(O,"/W {setlinewidth} bind def\n");
	fprintf(O,"/RGB {setrgbcolor} bind def\n");}

z_type lob(DB LB) {	int n; z_type s0,s1; s1=z_type(1.,1.); s0=s1;
				{ s1=log(s1)/LB; if( abs(s0-s1) < 1.e-14) break;
			  	s0=s1;	}
	return s1;
#define DO(x,y) for(x=0;x<y;x++)
main(int nar, char*ar[] ){ 
     printf("%s , TetrationTarameters Copyleft 2008 by Dmitrii Kouznetsov\n",ar[0]);
  printf("output: TetrationParameters.eps\n");
FILE *o; o=fopen("TetrationParameters.eps","w"); ado(o,260,140);
fprintf(o,"10 40 translate\n");
#define M(x,y) fprintf(o,"%5.2f %5.2f M\n",100.*(x),10.*(y));
#define L(x,y) fprintf(o,"%5.2f %5.2f L\n",100.*(x),10.*(y));
#define o(x,y) fprintf(o,"%5.2f %5.2f o\n",100.*(x),10.*(y));
M(0,-3)L(0,7) //M(0,0)L(2.1,0) 
fprintf(o,".2 W S\n");
int n; DB x,y,t;
for(n=0;n<7;n++){M(0,n)L(2.4,n)}  fprintf(o,".06 W S\n");
for(n=0;n<7;n++){M(-.04,n-.18) fprintf(o,"(%1d)s\n",n);}
M(-.09,M_E-.16) fprintf(o,"(e)s\n");
M(1./M_E,   -1.6)L(1./M_E,  9) 
M(log(2.),   -.9)L(log(2.),  6) 
M(log(10.), -1.8)L(log(10.),  6) 
fprintf(o,".06 W S\n"); 
for(n=2;n<23;n+=2){x=.1*n;M(x-.04,-.6) fprintf(o,"(%3.1f)s\n",x);}
M(log(2.)/2-.099, -2.7)	fprintf(o,"(ln[2]/2)s\n");
M(1./M_E  -.024 , -1.9) 	fprintf(o,"(1/e)s\n");
M(log(2.)  -.05, -1.) 	fprintf(o,"(ln[2])s\n");
M(log(10.)  -.03,-2) 	fprintf(o,"(ln[10])s\n"); 
fprintf(o,"0 0 0 RGB \n"); // eigenvalues 
DO(n,45) {t=.001+.05*n; x=t/exp(t); y=exp(t); if(n==0)M(x,y) else L(x,y) } 
fprintf(o,".2 W S\n"); // eigenvalues

fprintf(o,"0 .9 0 RGB \n"); //grow rate
DO(n,50) { t=.01+.001*n*exp(.1*n); x=t/exp(t); y=-2.*log(t); if(n==0)M(x,y) else L(x,y);}
fprintf(o,".8 W S\n"); // grow rate

fprintf(o,"0 0 1 RGB \n"); // period, growth
DO(n,50) { t=.0001+.0008*n*(1+.5*n)/(1+.02*n); x=t/exp(t); y=2.*M_PI/log(t); o(x,-y);}
fprintf(o,"1 0 0 RGB \n"); // period, decay
DO(n,33) { t=2.+.05*n*exp(.1*n); x=t/exp(t); y=2.*M_PI/log(t); o(x,y);}
///////////////////////COMPLEX BEGIN//////////////////////////
DB L;  z_type LB,Lb,q;
//real part
for(n=2;n<209;n+=4) {x=1./M_E+0.01*n;  Lb=lob(x); y=Re(Lb); L(x,y)
//printf("%6.3f %6.3f\n",x,y);
fprintf(o,".3 W 0 0 0 RGB S\n");
for(n=58;n>0;n--) {x=1./M_E+0.002*n*n/(1+.04*n);  Lb=lob(x);
//	printf("%2d \n",n);
 if(n/2*2==n) M(x,y) else L(x,y) }
for(n=2;n<58;n+=1) {x=1./M_E+0.002*n*n/(1+.04*n);  Lb=lob(x);
         y=-Im(Lb);  if(n/2*2==n) M(x,y) else L(x,y) }

for(n=0;n<10;n+=2){     x=.1/M_E*n;     M(x,0)
                        x=.1/M_E*(n+1); L(x,0)}
fprintf(o,".5 W S\n");                                                                            

//GREEN, incremnt
for(n=0;n<220;n+=10) {x=1./M_E+0.01*n;  Lb=lob(x);
        if(n==0)  M(x,y) else L(x,y)    }
fprintf(o,"1.1 W 0 .9 0 RGB S\n");
for(n=0;n<220;n+=2) {x=1./M_E+.01+0.01*n;  Lb=lob(x);
        if(n/4*4 == n)  M(x,y) else L(x,y)      }
fprintf(o,"0 setlinecap S\n");

//PINK, period
fprintf(o,"0 0 0 RGB\n");
for(n=12;n<82;n++) {x=1./M_E+0.005*n+.00025*n*n;  Lb=lob(x);
		        q=2*M_PI*I/log(x*Lb); y=Re(q); o(x,y)	}
fprintf(o,"1 0 1 RGB\n");
for(n=0;n<220;n+=3) {x=1./M_E+.011+0.01*n;  Lb=lob(x);
        q=2*M_PI*I/log(x*Lb);        y=Im(q); o(x,y) }