Tetration/Code/ApproLP100

// generator of figure 200px|right

// For the compillation of this code, the two graphical routines are required // ContourPlot/code/ado.cin    (function that makes header of the eps file) // ContourPlot/code/conto.cin (function which draws a level) // Copyleft 2008 by Dmitrii Kouznetosv.


 * 1) include 
 * 2) include 
 * 3) include 
 * 4) define DB double
 * 5) define DO(x,y) for(x=0;x
 * 7) define z_type complex
 * 8) define Re(x) x.real
 * 9) define Im(x) x.imag
 * 10) define I z_type(0.,1.)

z_type F4natu(z_type z) { int K=100,k; //int K=96,k; DB d[120]={ 0.30685281944005469058, 1.18353470251664338875 , 1.58593285160678321155 , 1.36629265207672068172 , 1.36264601823980036066 , 1.21734246689515424045 , 1.10981816083559525765 , 0.96674692974769849130 , 0.84089872598668435888 , 0.71353210966804747617 , 0.60168548504001373445 , 0.49928574281440518678 , 0.41140086629121763728 , 0.33506195665178500898 , 0.27104779243942234146 , 0.21728554054610033086 , 0.17311050207880035456 , 0.13690016038526570119 , 0.10765949732729711286 , 0.08413804539743192923 , 0.06542450487497340761 , 0.05060001212013485322 , 0.03895655493977817629 , 0.02985084640296329153 , 0.02277908979501017117 , 0.01730960309240666892 , 0.01310389615589767874 , 0.00988251130733762764 , 0.00742735935367278347 , 0.00556296426263720549 , 0.00415334478103463346 , 0.00309116153137843543 , 0.00229387529664008653 , 0.00169729976398295653 , 0.00125245885041635465 , 0.00092172809095368547 , 0.00067661152429638357 , 0.00049544127485341987 , 0.00036192128589181518 , 0.00026376927786672476 , 0.00019180840045267570 , 0.00013917553105723647 , 0.00010077412023867018 , 0.00007281884753121133 , 0.00005251474516228446 , 0.00003779882770351268 , 0.00002715594536867241 , 0.00001947408515177282 , 0.00001394059355016322 , 0.00000996213949015693 , 0.00000710713872292710 , 0.00000506199803708578 , 0.00000359960968975399 , 0.00000255569149787694 , 0.00000181175810338313 , 0.00000128245831538430 , 0.00000090647322737496 , 0.00000063980422418981 , 0.00000045095738191441 , 0.00000031741772125007 , 0.00000022312521183625 , 0.00000015663840476155 , 0.00000010982301013230 , 0.00000007690305934973 , 0.00000005378502675604 , 0.00000003757126131521 , 0.00000002621429405247 , 0.00000001826909956818 , 0.00000001271754463425 , 0.00000000884310192977 , 0.00000000614230041407 , 0.00000000426177146865 , 0.00000000295386817285 , 0.00000000204522503591 , 0.00000000141464900426 , 0.00000000097750884878 , 0.00000000067478454029 , 0.00000000046535930671 , 0.00000000032062550784 , 0.00000000022069891976 , 0.00000000015177557961 , 0.00000000010428189463 , 0.00000000007158597119 , 0.00000000004909806710 , 0.00000000003364531769 , 0.00000000002303635851 , 0.00000000001575933679 , 0.00000000001077213757 , 0.00000000000735717912 , 0.00000000000502077719 , 0.00000000000342362421 , 0.00000000000233271256 , 0.00000000000158818623 , 0.00000000000108046566 , 0.00000000000073450488 , 0.00000000000049894945 , 0.00000000000033868911 , 0.00000000000022973789 , 0.00000000000015572383 , 0.00000000000010548054 , 0.00000000000007139840 , 0.00000000000004829557 , 0.00000000000003264619 , 0.00000000000002205299 , 0.00000000000001488731 , 0.00000000000001004347 , 0.00000000000000677124 , 0.00000000000000456225 , 0.00000000000000307196 , 0.00000000000000206720 , 0.00000000000000139022 , 0.00000000000000093437 , 0.00000000000000062762 , 0.00000000000000042133 , 0.00000000000000028267 , 0.00000000000000018954 , 0.00000000000000012701 , 0.00000000000000008507 , 0.00000000000000005694 , 0.00000000000000003809 }; z_type s=0.; z_type z2=z/2.; z_type t=1.; for(k=0;k<=K;k++) { s+=d[k]*t; t*=z2; } //s+=4.+z; return s+log(z+2.); return s; }

main{ int j,k,m,n; DB x,y, p,q, t; z_type z,c,d, cu,cd; z_type Zo=z_type(.31813150520476413, 1.3372357014306895); z_type Zc=z_type(.31813150520476413,-1.3372357014306895); int M=300,M1=M+1; int N=600,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("TetrationApproLP100.eps","w");ado(o,0,0,604,604); fprintf(o,"302 302 translate\n 100 100 scale\n"); DO(m,M1) X[m]=-3+.02*m; DO(n,N1) Y[n]=-3+.01*(n+.5); for(m=-3;m<4;m++) {	if(m==0){M(m,-3.1)L(m,3.1)} else	{M(m,-3)L(m,3)}			} for(n=-3;n<4;n++) {M( -3,n)L(3,n)} fprintf(o,".006 W 0 0 0 RGB S\n"); z_type F[M1*N1]; DO(m,M1)DO(n,N1){	g[m*N1+n]=9999; f[m*N1+n]=9999;		} for(m=0;m-999 && p<999) g[m*N1+n]=p; if(q>-999 && q<999) f[m*N1+n]=q; } p=2;q=9; conto(o,f,w,v,X,Y,M,N, (-4     ),-q,q); fprintf(o,".004 W 1 0 0 RGB S\n"); conto(o,f,w,v,X,Y,M,N, (-3     ),-q,q); fprintf(o,".004 W 1 0 0 RGB S\n"); for(n=2;n<10;n+=2)conto(o,f,w,v,X,Y,M,N, (-3.+.1*n),-p,p); fprintf(o,".002 W 0 .8 0 RGB S\n"); conto(o,f,w,v,X,Y,M,N, (-2. ),-q,q); fprintf(o,".004 W 1 0 0 RGB S\n"); for(n=2;n<10;n+=2)conto(o,f,w,v,X,Y,M,N, (-2.+.1*n),-p,p); fprintf(o,".002 W 0 .8 0 RGB S\n"); conto(o,f,w,v,X,Y,M,N, (-1. ),-q,q); fprintf(o,".004 W 1 0 0 RGB S\n"); for(n=2;n<10;n+=2)conto(o,f,w,v,X,Y,M,N, (-1.+.1*n),-p,p); fprintf(o,".002 W 0 .8 0 RGB S\n"); conto(o,f,w,v,X,Y,M,N, ( 0. ),-99,99); fprintf(o,".004 W 0 0 0 RGB S\n"); for(n=2;n<10;n+=2)conto(o,f,w,v,X,Y,M,N, ( 0.+.1*n),-p,p); fprintf(o,".002 W 0 .8 0 RGB S\n"); conto(o,f,w,v,X,Y,M,N, ( 1. ),-q,q); fprintf(o,".004 W 0 0 1 RGB S\n"); for(n=2;n<10;n+=2)conto(o,f,w,v,X,Y,M,N, ( 1.+.1*n),-p,p); fprintf(o,".002 W 0 .8 0 RGB S\n"); conto(o,f,w,v,X,Y,M,N, ( 2. ),-q,q); fprintf(o,".004 W 0 0 1 RGB S\n"); for(n=2;n<10;n+=2)conto(o,f,w,v,X,Y,M,N, ( 2.+.1*n),-p,p); fprintf(o,".002 W 0 .8 0 RGB S\n"); conto(o,f,w,v,X,Y,M,N, ( 3     ),-q,q); fprintf(o,".004 W 0 0 1 RGB S\n"); conto(o,f,w,v,X,Y,M,N, ( 4     ),-q,q); fprintf(o,".004 W 0 0 1 RGB S\n"); //                  conto(o,g,w,v,X,Y,M,N, (-4. ),-p,p); fprintf(o,".004 W 0 0 0 RGB S\n"); conto(o,g,w,v,X,Y,M,N, (-3. ),-p,p); fprintf(o,".004 W 0 0 0 RGB S\n"); for(n=2;n<10;n+=2)conto(o,g,w,v,X,Y,M,N, (-3.+.1*n),-p,p); fprintf(o,".002 W 1 0 0 RGB S\n"); conto(o,g,w,v,X,Y,M,N, (-2. ),-p,p); fprintf(o,".004 W 0 0 0 RGB S\n"); for(n=2;n<10;n+=2)conto(o,g,w,v,X,Y,M,N, (-2.+.1*n),-p,p); fprintf(o,".002 W 1 0 0 RGB S\n"); conto(o,g,w,v,X,Y,M,N, (-1. ),-q,q); fprintf(o,".004 W 0 0 0 RGB S\n"); for(n=2;n<10;n+=2)conto(o,g,w,v,X,Y,M,N, (-1.+.1*n),-p,p); fprintf(o,".002 W 1 0 0 RGB S\n"); conto(o,g,w,v,X,Y,M,N, (0. ),-99,99); fprintf(o,".004 W 0 0 0 RGB S\n"); for(n=2;n<10;n+=2)conto(o,g,w,v,X,Y,M,N, (   .1*n),-p,p); fprintf(o,".002 W 0 0 1 RGB S\n"); conto(o,g,w,v,X,Y,M,N, ( 1. ),-q,q); fprintf(o,".004 W 0 0 0 RGB S\n"); for(n=2;n<10;n+=2)conto(o,g,w,v,X,Y,M,N, ( 1.+.1*n),-p,p); fprintf(o,".002 W 0 0 1 RGB S\n"); conto(o,g,w,v,X,Y,M,N, ( 2. ),-p,p); fprintf(o,".004 W 0 0 0 RGB S\n"); for(n=2;n<10;n+=2)conto(o,g,w,v,X,Y,M,N, ( 2.+.1*n),-p,p); fprintf(o,".002 W 0 0 1 RGB S\n"); conto(o,g,w,v,X,Y,M,N, ( 3. ),-p,p); fprintf(o,".004 W 0 0 0 RGB S\n"); conto(o,g,w,v,X,Y,M,N, ( 4. ),-p,p); fprintf(o,".004 W 0 0 0 RGB S\n"); conto(o,g,w,v,X,Y,M,N, ( 5. ),-p,p); fprintf(o,".004 W 0 0 0 RGB S\n"); conto(o,g,w,v,X,Y,M,N, ( 6. ),-p,p); fprintf(o,".004 W 0 0 0 RGB S\n"); conto(o,g,w,v,X,Y,M,N, ( 7. ),-p,p); fprintf(o,".004 W 0 0 0 RGB S\n"); conto(o,g,w,v,X,Y,M,N, ( 8. ),-p,p); fprintf(o,".004 W 0 0 0 RGB S\n"); conto(o,g,w,v,X,Y,M,N, ( 9. ),-p,p); fprintf(o,".004 W 0 0 0 RGB S\n"); conto(o,g,w,v,X,Y,M,N, (10. ),-p,p); fprintf(o,".004 W 0 0 0 RGB S\n"); //                  conto(o,f,w,v,X,Y,M,N, ( Im(Zo)     ),-p,p); fprintf(o,".005 W 0 .6 0 RGB S\n"); conto(o,f,w,v,X,Y,M,N, (-Im(Zo)    ),-p,p); fprintf(o,".005 W 0 .6 0 RGB S\n"); conto(o,g,w,v,X,Y,M,N, (Re(Zo)    ),-p,p); fprintf(o,".005 W .7 0 .7 RGB S\n"); //M(-10,0)L(-2,0)fprintf(o,".04 W 1 0 1 RGB S\n"); //draw the pink cutline fprintf(o,"showpage\n\%\%\%Trailer"); fclose(o); //system( "ggv TetrationApproLP100.eps"); //for linux system( "open TetrationApproLP100.eps"); //for macintosh system("ps2pdf TetrationApproLP100.eps"); getchar; system("killall Preview");	 //for macintosh } // end of file TetrationApproLP100.cc
 * 1) include "conto.cin"