Tetration/Code/HolomorphicBaseSqrt2v01: Difference between revisions
imported>Dmitrii Kouznetsov (I replace the old version with the precise algorithm. I expect it to give 14 decimal digits. The figure is almost the same; I do not replace it.) |
imported>Dmitrii Kouznetsov m (remove comment from the program) |
||
Line 44: | Line 44: | ||
DB X[M1],Y[N1], g[M1*N1],f[M1*N1], w[M1*N1]; // w is working array. | 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 | char v[M1*N1]; // v is working array | ||
FILE *o;o=fopen("TetrationBaseSqrt2v01a.eps","w"); | |||
FILE *o;o=fopen("TetrationBaseSqrt2v01a.eps","w"); | |||
ado(o,0,0,214,212); | ado(o,0,0,214,212); | ||
fprintf(o,"112 110 translate\n 10 10 scale\n"); | fprintf(o,"112 110 translate\n 10 10 scale\n"); |
Revision as of 04:51, 24 March 2009
The metadata subpage is missing. You can start it via filling in this form or by following the instructions that come up after clicking on the [show] link to the right. | |||
---|---|---|---|
|
// Generator of the eps version of plot ot holomorphic tetration at base
in the compex plane
// The following graphical functions are required to compile it:
// ContourPlot/code/ado.cin
// ContourPlot/code/conto.cin
// Copyleft 2008,2009 by Dmitrii Kouznetsov
#include <math.h> #include <stdio.h> #include <stdlib.h> #define DB double #define DO(x,y) for(x=0;x<y;x++) #include <complex.h> #define z_type complex<double> #define Re(x) x.real() #define Im(x) x.imag() #define I z_type(0.,1.) #include "conto.cin" DB coef[12]= // Copypast from Mathematica {2.00000000000000000, -1.00000000000000000, -0.564722838317732364, -0.338177586851183300, -0.210331302138627770, -0.134454879052109797, -0.0877843886012191373, -0.0582880930830946915, -0.0392407117837278383, -0.0267232860342981439, -0.0183765205976375959, -0.0127420898467766479}; z_type sqrt2a(z_type z){int n; z_type e,s; e=exp(-0.36651292058166432701*(z+1.25155147882219)); s=coef[11]; for(n=10;n>=0;n--) { s*=e; s+=coef[n]; } return s; } z_type sqrt2b(z_type z){ if(Re(z)>5) return sqrt2a(z); return log(sqrt2b(z+1.))/log(sqrt(2.)); }
main(){ int j,k,m,n; DB x,y, p,q, t; z_type z,c,d, cu,cd;
int K=200,K1=K+1; DB A=10.; DB dy=2*A/K; printf("dy=%6.3f",dy); #define Y(k) (dy*(k-K/2)) printf("y_0=%6.3f y_K=%6.3f ",Y(0), Y(K)); int M=300,M1=M+1; int N=300,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("TetrationBaseSqrt2v01a.eps","w"); ado(o,0,0,214,212); fprintf(o,"112 110 translate\n 10 10 scale\n"); DB sy=10./(N/2.); DO(m,M1) X[m]=-11+.07*m; DO(n,N1) Y[n]=sy*(n-N/2.+.5); for(m=-10;m<11;m++) {M(m,-10)L(m,10)} for(n=-10;n<11;n++) {M( -10,n)L(10,n)} fprintf(o,".006 W 0 0 0 RGB S\n"); fprintf(o,"/adobe-Roman findfont 1 scalefont setfont\n"); for(m=-8;m<0;m+=2) {M(-11.2,m-.3) fprintf(o,"(%1d)s\n",m);} for(m= 0;m<9;m+=2) {M(-10.7,m-.3) fprintf(o,"(%1d)s\n",m);} for(m=-8;m<0;m+=4) {M(m-.6,-10.8) fprintf(o,"(%1d)s\n",m);} for(m= 0;m<9;m+=4) {M(m-.3,-10.8) fprintf(o,"(%1d)s\n",m);} fprintf(o,"/Times-Italic findfont 1 scalefont setfont\n"); //fprintf(o,"/adobe-italic findfont 1 scalefont setfont\n"); M( 9.6,-10.8) fprintf(o,"(y)s\n"); M(-10.7, 9.5) fprintf(o,"(x)s\n"); M(-11,0)L(10.1,0) M(0,-11)L(0,10.1) fprintf(o,".01 W 1 0 1 RGB S\n"); z_type tm,tp,F[M1*N1];;
DO(m,M1)DO(n,N1){ g[m*N1+n]=9999; f[m*N1+n]=9999;} for(m=0;m<M1;m++){ x=X[m]; int m1; DO(n,N1){y=Y[n]; z=z_type(x,y); // c=sqrt2a(z)-log(sqrt2a(z+1.))/log(sqrt(2.)); c=sqrt2b(z); p=Re(c); q=Im(c); if(p>-9999 && p<9999) g[m*N1+n]=p; if(q>-9999 && q<9999) f[m*N1+n]=q; } } p=.8;
p=.8; conto(o,f,w,v,X,Y,M,N, (-5. ), -1,1); fprintf(o,".06 W 1 0 0 RGB S\n"); conto(o,f,w,v,X,Y,M,N, (-4. ), -2,2); fprintf(o,".06 W 1 0 0 RGB S\n"); for(n=2;n<10;n+=2)conto(o,f,w,v,X,Y,M,N, (-4.+.1*n),-.3,.3);fprintf(o,".01 W 0 1 0 RGB S\n"); conto(o,f,w,v,X,Y,M,N, (-3. ), -p,p); fprintf(o,".06 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),-.3,.3);fprintf(o,".01 W 0 1 0 RGB S\n"); conto(o,f,w,v,X,Y,M,N, (-2. ), -2,2); fprintf(o,".06 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),-.3,.3);fprintf(o,".01 W 0 1 0 RGB S\n"); conto(o,f,w,v,X,Y,M,N, (-1. ), -p,p); fprintf(o,".06 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),-.1,.1);fprintf(o,".01 W 0 1 0 RGB S\n"); conto(o,f,w,v,X,Y,M,N, (0. ), -p,p); fprintf(o,".06 W 0 .8 0 RGB S\n"); for(n=2;n<10;n+=2)conto(o,f,w,v,X,Y,M,N, ( 0+ .1*n),-.1,.1);fprintf(o,".01 W 0 1 0 RGB S\n"); conto(o,f,w,v,X,Y,M,N, ( 1. ), -p,p); fprintf(o,".06 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),-.3,.3);fprintf(o,".01 W 0 1 0 RGB S\n"); conto(o,f,w,v,X,Y,M,N, ( 2. ), -2,2); fprintf(o,".06 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),-.3,.3); fprintf(o,".01 W 0 1 0 RGB S\n"); conto(o,f,w,v,X,Y,M,N, ( 3. ), -2,2); fprintf(o,".06 W 0 0 1 RGB S\n"); for(n=2;n<10;n+=2)conto(o,f,w,v,X,Y,M,N, ( 3.+.1*n),-.3,.3);fprintf(o,".01 W 0 1 0 RGB S\n"); conto(o,f,w,v,X,Y,M,N, ( 4. ), -2,2); fprintf(o,".06 W 0 0 1 RGB S\n"); conto(o,f,w,v,X,Y,M,N, ( 5. ), -1,1); fprintf(o,".06 W 0 0 1 RGB S\n"); conto(o,g,w,v,X,Y,M,N, (-2. ),-3,3); fprintf(o,".06 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,".01 W 1 0 0 RGB S\n"); conto(o,g,w,v,X,Y,M,N, (-1. ),-3,3); fprintf(o,".06 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,".01 W 1 0 0 RGB S\n"); conto(o,g,w,v,X,Y,M,N, (0. ),-3,3); fprintf(o,".06 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,".01 W 0 0 1 RGB S\n"); conto(o,g,w,v,X,Y,M,N, ( 1. ),-3,3); fprintf(o,".06 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,".01 W 0 0 1 RGB S\n"); conto(o,g,w,v,X,Y,M,N, ( 2. ),-3,3); fprintf(o,".06 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,".01 W 0 0 1 RGB S\n"); conto(o,g,w,v,X,Y,M,N, ( 3. ),-3,3); fprintf(o,".06 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,".01 W 0 0 1 RGB S\n"); conto(o,g,w,v,X,Y,M,N, ( 4. ),-3,3); fprintf(o,".06 W 0 0 0 RGB S\n"); for(n=2;n<10;n+=2)conto(o,g,w,v,X,Y,M,N, ( 4.+.1*n),-p,p); fprintf(o,".01 W 0 0 1 RGB S\n"); conto(o,g,w,v,X,Y,M,N, ( 5. ),-2,2); fprintf(o,".06 W 0 0 0 RGB S\n");
z=1.e-16; printf("%18.16f \n", Re(sqrt2b(-z))); printf("%18.16f \n", Re(sqrt2b( z)));
//M(-10,0)L(-2,0)fprintf(o,".04 W 1 0 1 RGB S\n");
fprintf(o,"showpage\n\%\%\%Trailer"); fclose(o); system( "ggv TetrationBaseSqrt2v01a.eps &"); //for UNIX // system("open TetrationBaseSqrt2v01a.eps"); //for macintosh system("nice ps2pdf TetrationBaseSqrt2v01a.eps"); //getchar(); system("killall Preview"); // For macintosh
}
// end of TetrationBaseSqrt2v01.cc //