// Generator of image
// showing the complex map of ArcTetration to base e.
// The following files are required for the compilation:
// fslog.cin (implementation of ArcTetraton, approximation of function ate )
// ado.cin (make header of the EPS file)
// conto.cin (draws the isoline as implicit plot )
// plofu.cin (set of calls of conto )
// The output files expected are "b271az.eps" and "b271az.pdf"
// Copyleft 2009-2011 by Dmitrii Kouznetsov:
// Please, attribute the source
// http://tori.ils.uec.ac.jp/TORI/index.php/b271az.cc
// and this license at the use or redistriburion.
#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;
// #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 T22=-8.5715740896774235522;
//DB T42= 9.6180745210214273558;
//#include "f21E.cin"
//#include "e1etf.cin"
//#include "f15.cin"
//#include "fsexp.cin"
#include "fslog.cin"
main(){ int j,k,m,n; DB x,y, p,q, t; z_type z,c,d, cu,cd;
int M=401,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("b271az.eps","w"); ado(o,87,87);
fprintf(o,"46 45 translate\n 10 10 scale\n");
DO(m,M1) X[m]=-4.+.02*(m-.5);
DO(n,N1) Y[n]=-4.+.02*(n-.5);
for(m=-4;m<5;m++) {M(m,-4)L(m,4)}
for(n=-4;n<5;n++) {M( -4,n)L(4,n)} fprintf(o,".006 W 0 0 0 RGB S\n");
fprintf(o,"/adobe-Roman findfont .6 scalefont setfont\n");
// for(m=-2;m<0;m+=2) {M(-4.6,m-.2) fprintf(o,"(%1d)s\n",m);}
// for(m= 0;m<3;m+=2) {M(-4.4,m-.2) fprintf(o,"(%1d)s\n",m);}
// for(m=-2;m<0;m+=2) {M(m-.3,-4.48) fprintf(o,"(%1d)s\n",m);}
// for(m= 0;m<3;m+=2) {M(m-.16,-4.48) 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(-4.7, 4.5) fprintf(o,"(y)s\n");
M( 4.6,-4.8) fprintf(o,"(x)s\n");
M(-4,0)L(4.1,0) M(0,-4)L(0,4.1) fprintf(o,".01 W 1 0 1 RGB S\n");
*/
DO(m,M1)DO(n,N1){ g[m*N1+n]=9999;
f[m*N1+n]=9999;}
DB b=sqrt(2);
DO(m,M1){x=X[m]; printf("x=%6.3f\n",x);
DO(n,N1){y=Y[n]; z=z_type(x,y);
if(abs(z+2.)>.04)
{
// c=F21E(z);
// c=E1ETF(z);
// c=F15(z);
// c=FSEXP(z);
c=FSLOG(z);
p=Re(c); q=Im(c);
if(p>-9999 && p<9999 && fabs(q)>1.e-12) g[m*N1+n]=p;
if(q>-9999 && q<9999 && fabs(q)>1.e-12) f[m*N1+n]=q;
}
}}
fprintf(o,"1 setlinejoin 2 setlinecap\n");
p=2.; q=1.1;;
#include "plofu.cin"
fprintf(o,"0 setlinejoin 0 setlinecap\n");
fprintf(o,"showpage\n");
fprintf(o,"%cTrailer\n",'%');
fclose(o);
system("epstopdf b271az.eps");
system( "open b271az.pdf"); //for macintosh
getchar(); system("killall Preview"); // For macintosh
}
//
//
//
//