Difference between revisions of "File:Gz2z1mapT.jpg"
(Complex map of function $g(z)=\log_2(1+1/z)$ $u+\mathrm i v= g(x+\mathrm i y)$ ==C++ generator of curves== //</nowiki></nomathjaz></poem> ==Latex generator of labels== %<poem><nomathjax><nowiki> %</nowiki></nomathjaz></poem> [[Categor...) |
(C++) |
||
Line 6: | Line 6: | ||
==[[C++]] generator of curves== |
==[[C++]] generator of curves== |
||
+ | // |
||
+ | <poem> <nomathjaz> <nowiki> |
||
+ | #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 std::complex<double> z_type; |
||
+ | #define Re(x) x.real() |
||
+ | #define Im(x) x.imag() |
||
+ | #define I z_type(0.,1.) |
||
+ | #include "conto.cin" |
||
+ | |||
+ | DB c=2.; |
||
+ | z_type F(z_type z) {return (c-1.)/(pow(c,z)-c);} |
||
+ | z_type G(z_type z) {return log( 1. + (c-1.)/z ) / log(c);} |
||
+ | |||
+ | int main(){ int j,k,m,n; DB x,y, p,q, t; z_type z,c,d, cu,cd; |
||
+ | int M=1001,M1=M+1; |
||
+ | int N=1001,N1=N+1; |
||
+ | DB X[M1],Y[N1]; DB *g, *f, *w; // w is working array. |
||
+ | g=(DB *)malloc((size_t)((M1*N1)*sizeof(DB))); |
||
+ | f=(DB *)malloc((size_t)((M1*N1)*sizeof(DB))); |
||
+ | w=(DB *)malloc((size_t)((M1*N1)*sizeof(DB))); |
||
+ | char v[M1*N1]; // v is working array |
||
+ | FILE *o;o=fopen("gz2z1map.eps","w"); ado(o,2002,2002); |
||
+ | fprintf(o,"1001 1001 translate\n 100 100 scale\n"); |
||
+ | fprintf(o,"1 setlinejoin 2 setlinecap\n"); |
||
+ | DO(m,M1) X[m]=-10+.02*(m-.5); |
||
+ | DO(n,N1) Y[n]=-10+.02*(n-.5); |
||
+ | //for(n=0;n<N1;n++) { Y[n]=1.09*sinh((3./200.)*(n-200)); printf("%3d %9.6f\n",n,Y[n]); } |
||
+ | 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"); |
||
+ | DO(m,M1)DO(n,N1){ g[m*N1+n]=999; |
||
+ | f[m*N1+n]=999;} |
||
+ | DO(m,M1){x=X[m]; if(m/10*10==m) printf("x=%6.3f\n",x); |
||
+ | DO(n,N1){y=Y[n]; z=z_type(x,y); //if(abs(z+2.)>.019) |
||
+ | c=G(z); |
||
+ | // p=abs(c-z)/(abs(c)+abs(z)); p=-log(p)/log(10.); if(p>0 && p<17) g[m*N1+n]=p; |
||
+ | p=Re(c); q=Im(c); if(p>-19 && p<19 ){ g[m*N1+n]=p;f[m*N1+n]=q;} |
||
+ | }} |
||
+ | fprintf(o,"1 setlinejoin 1 setlinecap\n"); |
||
+ | |||
+ | p=1.2;q=.4; |
||
+ | for(m=-5;m<5;m++)for(n=1;n<10;n+=1)conto(o,f,w,v,X,Y,M,N,(m+.1*n),-q,q);fprintf(o,".014 W 0 .6 0 RGB S\n"); |
||
+ | for(m=0;m<4;m++) for(n=1;n<10;n+=1)conto(o,g,w,v,X,Y,M,N,-(m+.1*n),-q,q);fprintf(o,".014 W .8 0 0 RGB S\n"); |
||
+ | for(m=0;m<4;m++) for(n=1;n<10;n+=1)conto(o,g,w,v,X,Y,M,N, (m+.1*n),-q,q);fprintf(o,".014 W 0 0 .8 RGB S\n"); |
||
+ | for(m= 1;m<6;m++) conto(o,f,w,v,X,Y,M,N, (0.-m),-p,p);fprintf(o,".05 W .8 0 0 RGB S\n"); |
||
+ | for(m= 1;m<6;m++) conto(o,f,w,v,X,Y,M,N, (0.+m),-p,p);fprintf(o,".05 W 0 0 .8 RGB S\n"); |
||
+ | conto(o,f,w,v,X,Y,M,N, (0. ),-2*p,2*p); fprintf(o,".05 W .5 0 .5 RGB S\n"); |
||
+ | for(m=-6;m<7;m++)conto(o,g,w,v,X,Y,M,N,(0.+m),-p,p);fprintf(o,".05 W 0 0 0 RGB S\n"); |
||
+ | |||
+ | fprintf(o,"0 setlinejoin 0 setlinecap\n"); |
||
+ | M(0,0)L(-1,0) fprintf(o,"1 1 1 RGB .02 W S\n"); |
||
+ | DO(n,10) {M(-.1*(n),0)L(-.1*(n-.3),0)} |
||
+ | fprintf(o,"0 0 0 RGB .025 W S\n"); |
||
+ | |||
+ | //#include "plofu.cin" |
||
+ | fprintf(o,"showpage\n"); |
||
+ | fprintf(o,"%c%cTrailer\n",'%','%'); |
||
+ | fclose(o); free(f); free(g); free(w); |
||
+ | system("epstopdf gz2z1map.eps"); |
||
+ | system( "open gz2z1map.pdf"); //for macintosh |
||
+ | getchar(); system("killall Preview"); // For macintosh |
||
+ | } |
||
//</nowiki></nomathjaz></poem> |
//</nowiki></nomathjaz></poem> |
||
Revision as of 12:50, 23 September 2013
Complex map of function $g(z)=\log_2(1+1/z)$
$u+\mathrm i v= g(x+\mathrm i y)$
C++ generator of curves
//
<nomathjaz>
#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 std::complex<double> z_type;
#define Re(x) x.real()
#define Im(x) x.imag()
#define I z_type(0.,1.)
#include "conto.cin"
DB c=2.;
z_type F(z_type z) {return (c-1.)/(pow(c,z)-c);}
z_type G(z_type z) {return log( 1. + (c-1.)/z ) / log(c);}
int main(){ int j,k,m,n; DB x,y, p,q, t; z_type z,c,d, cu,cd;
int M=1001,M1=M+1;
int N=1001,N1=N+1;
DB X[M1],Y[N1]; DB *g, *f, *w; // w is working array.
g=(DB *)malloc((size_t)((M1*N1)*sizeof(DB)));
f=(DB *)malloc((size_t)((M1*N1)*sizeof(DB)));
w=(DB *)malloc((size_t)((M1*N1)*sizeof(DB)));
char v[M1*N1]; // v is working array
FILE *o;o=fopen("gz2z1map.eps","w"); ado(o,2002,2002);
fprintf(o,"1001 1001 translate\n 100 100 scale\n");
fprintf(o,"1 setlinejoin 2 setlinecap\n");
DO(m,M1) X[m]=-10+.02*(m-.5);
DO(n,N1) Y[n]=-10+.02*(n-.5);
//for(n=0;n<N1;n++) { Y[n]=1.09*sinh((3./200.)*(n-200)); printf("%3d %9.6f\n",n,Y[n]); }
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");
DO(m,M1)DO(n,N1){ g[m*N1+n]=999;
f[m*N1+n]=999;}
DO(m,M1){x=X[m]; if(m/10*10==m) printf("x=%6.3f\n",x);
DO(n,N1){y=Y[n]; z=z_type(x,y); //if(abs(z+2.)>.019)
c=G(z);
// p=abs(c-z)/(abs(c)+abs(z)); p=-log(p)/log(10.); if(p>0 && p<17) g[m*N1+n]=p;
p=Re(c); q=Im(c); if(p>-19 && p<19 ){ g[m*N1+n]=p;f[m*N1+n]=q;}
}}
fprintf(o,"1 setlinejoin 1 setlinecap\n");
p=1.2;q=.4;
for(m=-5;m<5;m++)for(n=1;n<10;n+=1)conto(o,f,w,v,X,Y,M,N,(m+.1*n),-q,q);fprintf(o,".014 W 0 .6 0 RGB S\n");
for(m=0;m<4;m++) for(n=1;n<10;n+=1)conto(o,g,w,v,X,Y,M,N,-(m+.1*n),-q,q);fprintf(o,".014 W .8 0 0 RGB S\n");
for(m=0;m<4;m++) for(n=1;n<10;n+=1)conto(o,g,w,v,X,Y,M,N, (m+.1*n),-q,q);fprintf(o,".014 W 0 0 .8 RGB S\n");
for(m= 1;m<6;m++) conto(o,f,w,v,X,Y,M,N, (0.-m),-p,p);fprintf(o,".05 W .8 0 0 RGB S\n");
for(m= 1;m<6;m++) conto(o,f,w,v,X,Y,M,N, (0.+m),-p,p);fprintf(o,".05 W 0 0 .8 RGB S\n");
conto(o,f,w,v,X,Y,M,N, (0. ),-2*p,2*p); fprintf(o,".05 W .5 0 .5 RGB S\n");
for(m=-6;m<7;m++)conto(o,g,w,v,X,Y,M,N,(0.+m),-p,p);fprintf(o,".05 W 0 0 0 RGB S\n");
fprintf(o,"0 setlinejoin 0 setlinecap\n");
M(0,0)L(-1,0) fprintf(o,"1 1 1 RGB .02 W S\n");
DO(n,10) {M(-.1*(n),0)L(-.1*(n-.3),0)}
fprintf(o,"0 0 0 RGB .025 W S\n");
//#include "plofu.cin"
fprintf(o,"showpage\n");
fprintf(o,"%c%cTrailer\n",'%','%');
fclose(o); free(f); free(g); free(w);
system("epstopdf gz2z1map.eps");
system( "open gz2z1map.pdf"); //for macintosh
getchar(); system("killall Preview"); // For macintosh
}
//</nomathjaz>
Latex generator of labels
%
<nomathjax>
%</nomathjaz>
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 12:44, 23 September 2013 | 4,175 × 4,175 (1.67 MB) | T (talk | contribs) | Complex map of function $g(z)=\log_2(1+1/z)$ $u+\mathrm i v= g(x+\mathrm i y)$ ==C++ generator of curves== //</nowiki></nomathjaz></poem> ==Latex generator of labels== %<poem><nomathjax><nowiki> %</nowiki></nomathjaz></poem> [[Categor... |
You cannot overwrite this file.
File usage
The following page uses this file: