NOTICE: Citizendium is still being set up on its newer server, treat as a beta for now; please see here for more.
Citizendium - a community developing a quality comprehensive compendium of knowledge, online and free. Click here to join and contribute—free
Click here to participate in the November 2016 election.
CZ thanks our previous donors. Donate here. Treasurer's Financial Report -- Thanks to our content contributors. --


From Citizendium, the Citizens' Compendium
< Tetration‎ | Code(Redirected from ExampleEquationLog01)
Jump to: navigation, search

// ExampleEquationLog01.png

// 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);}
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);}
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");
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");
// 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.