Tetration/Code/ExampleEquationLog01: Difference between revisions
Jump to navigation
Jump to search
imported>Dmitrii Kouznetsov (New page: // 300px // C++ code that generates figure Image:ExampleEquationLog01.png above // that is used in articlex // Equation and [[User:Dmitrii Kouz...) |
imported>Chris Day m (ExampleEquationLog01 moved to Tetration/Code/ExampleEquationLog01) |
(No difference)
|
Revision as of 23:55, 18 February 2009
// // C++ code that generates figure Image:ExampleEquationLog01.png above // that is used in articlex // Equation and User:Dmitrii Kouznetsov/Analytic Tetration // #include <math.h> #include <stdio.h> #include <stdlib.h> #define DB double 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,"/times-Roman findfont 6 scalefont setfont\n"); fprintf(O,"/W {setlinewidth} bind def\n"); fprintf(O,"/RGB {setrgbcolor} bind def\n");} #define DO(x,y) for(x=0;x<y;x++) main(){ FILE *o; o=fopen("log.eps","w"); ado(o,800,800); fprintf(o,"10 10 scale\n"); fprintf(o,"10 10 translate\n"); #define M(x,y) fprintf(o,"%5.2f %5.2f M\n",10.*(x),10.*(y)); #define L(x,y) fprintf(o,"%5.2f %5.2f L\n",10.*(x),10.*(y)); M(0,6.3)L(0,0) L(6.3,0) fprintf(o,".3 W S\n"); int n; DB x,y,t; for(n=1;n<7;n++){M(0,n)L(6,n)} fprintf(o,".06 W S\n"); for(n=0;n<6;n++){M(-.4,n-.18) fprintf(o,"(%1d)s\n",n);} for(n=1;n<7;n++){x=1*n;M(x,0)L(x,6)} M(-.5,M_E)L(6,M_E) M(M_E,-.5)L(M_E,6) fprintf(o,".06 W S\n"); for(n=1;n<6;n+=1){x=1*n;M(x-.16,-.5) fprintf(o,"(%1.0f)s\n",x);} M(0,0)L(7,7) fprintf(o,".4 W S\n"); M(-.8,M_E-.16) fprintf(o,"(e)s\n"); M(M_E-.14,-.8) fprintf(o,"(e)s\n"); fprintf(o,"/Times-Italic findfont 6 scalefont setfont\n"); M(-0.5,6) fprintf(o,"(y)s\n"); M(6,-0.5) fprintf(o,"(x)s\n"); for(n=0;n<70;n+=2){x=.8+.02*n+.001*n*n;y=log(x)/log(sqrt(2.)); if(n==0)M(x,y)else L(x,y)} fprintf(o,"1 0 0 RGB 0.3 W S\n"); for(n=0;n<70;n+=2){x=.7+.02*n+.001*n*n;y=log(x)/log(exp(1/M_E)); if(n==0)M(x,y)else L(x,y)} fprintf(o,"0 .8 0 RGB 0.3 W S\n"); for(n=0;n<70;n+=2){x=.6+.02*n+.001*n*n;y=log(x)/log (2.); if(n==0)M(x,y)else L(x,y)} fprintf(o,"0 0 1 RGB 0.3 W S\n"); fprintf(o,"showpage\n"); fprintf(o,"%cTrailer\n",'%'); fclose(o); }
// Conditions of use: // Feel free to download it, compile it, run it, distribute it, modify it. Please indicate modification(s), if any, and keep this line. Copyleft 2008 by Dmitrii Kouznetsov.