File:AcipmapTpng.png

From TORI
Revision as of 09:41, 21 June 2013 by Maintenance script (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Original file(844 × 838 pixels, file size: 199 KB, MIME type: image/png)

Complex map of function ArcCip

C++ generator of curves

For technical reasons, the generator of curves is divided to few file

plofu.cin

The code below should be stored as plofu.cin . It determines thickness and color of drawing of the contour of levels of constant real part of the function and those for the imaginary part; and also values of these levels. The separation from other funcitons allows to plot several maps in the same style. However, for different pictures, the different styles may be required; so, these commands are not stores at plofu.cin.

fprintf(o,"1 setlinejoin 1 setlinecap\n"); p=1.8;q=.7;
for(m=-11;m<11;m++)for(n=2;n<10;n+=2)conto(o,f,w,v,X,Y,M,N,(m+.1*n),-q, q); fprintf(o,".01 W 0 .6 0 RGB S\n");
for(m=0;m<10;m++) for(n=2;n<10;n+=2)conto(o,g,w,v,X,Y,M,N,-(m+.1*n),-q, q); fprintf(o,".01 W .9 0 0 RGB S\n");
for(m=0;m<10;m++) for(n=2;n<10;n+=2)conto(o,g,w,v,X,Y,M,N, (m+.1*n),-q, q); fprintf(o,".01 W 0 0 .9 RGB S\n");
for(m=1;m<11;m++)  conto(o,f,w,v,X,Y,M,N, (0.-m),-p,p); fprintf(o,".03 W .9 0 0 RGB S\n");
for(m=1;m<11;m++)  conto(o,f,w,v,X,Y,M,N, (0.+m),-p,p); fprintf(o,".03 W 0 0 .9 RGB S\n");
                 conto(o,f,w,v,X,Y,M,N, (0.  ),-p,p); fprintf(o,".03 W .6 0 .6 RGB S\n");
for(m=-9;m<10;m++) conto(o,g,w,v,X,Y,M,N, (0.+m),-p,p); fprintf(o,".03 W 0 0 0 RGB S\n");

Evaluation of AcrCip

The routines for evaluation of ArcCip aslo are stored separately. This makes easy the include to various codes. The text below should be stored as acip.cin. For the best performance in a general case, the complex double function ACip5 should be called. other functions are good only for the special case. Below, z_type means complex double (although, the definition as just complex also may provide the workable program).

z_type Cip(z_type z) {return cos(z)/z;}
z_type Cipp(z_type z) {return (-sin(z) - cos(z)/z)/z ;}
z_type ACip0(z_type z) {z_type t=1./(z*z);
       return (1.
       +t*(-1./2.
       +t*(13./24.
       +t*(-541./720.
       +t*(9509./8064.
       +t*(-7231801./3628800.
       +t*(1695106117./479001600.
       +t*(-567547087381./87178291200.)))))))
       )/z ; }
z_type ACip1(z_type z){int n; z_type c=ACip0(z);
       c+=.1*(z-Cip(c))/Cipp(c) ;
       c+=.2*(z-Cip(c))/Cipp(c) ;
       c+=.3*(z-Cip(c))/Cipp(c) ;
       c+=.4*(z-Cip(c))/Cipp(c) ;
       c+=.5*(z-Cip(c))/Cipp(c) ;
       c+=.7*(z-Cip(c))/Cipp(c) ;
       DO(n,8) c+=(z-Cip(c))/Cipp(c) ;
       return c;
       } // ACip0 does not know about the singulatiry.
z_type acos(z_type z){
if(Im(z)<0){if(Re(z)>=0){return I*log( z + sqrt(z*z-1.) );} 
                    else{return I*log( z - sqrt(z*z-1.) );}}
            if(Re(z)>=0){return -I*log( z + sqrt(z*z-1.) );} 
                   else {return -I*log( z - sqrt(z*z-1.) );} }
z_type ACipb(z_type z){ z_type t = 0.33650841691839534 + z ; z_type u=sqrt(t);
return  
  2.798386045783887
+u*(-2.437906425896532
+u*(0.7079542331649882 
+u*(-.5009330133042798
+u*(0.5714459932734446 
)))); }
z_type ACip3(z_type z){int n; z_type c=ACipb(z);
       c+=.2*(z-Cip(c))/Cipp(c) ;
       c+=.5*(z-Cip(c))/Cipp(c) ;
       DO(n,8) c+=(z-Cip(c))/Cipp(c) ;
//        DO(n,8) c=acos(c*z) ;
//        DO(n,8) c=cos(c)/z ;
       return c;
       } 
z_type ACip4(z_type z){int n; z_type z1=z_type(0,1.62134794610324);
       z_type t=z-z1; 
       z_type c;
       c=-z1+2.*sqrt(I*t);
//     c=z1+t*(-2.+t*z_type(0,4.) );
       c+=.2*(z-Cip(c))/Cipp(c) ;
       c+=.5*(z-Cip(c))/Cipp(c) ;
       DO(n,8) c+=.9*(z-Cip(c))/Cipp(c) ;
       return c;
       }
z_type ACip5(z_type z){int n;
       if(Re(z)>0 && abs(z)>1.2) return ACip1(z);
       if(Re(z)>-2 && fabs(Im(z))<1.) return ACip3(z);
       if(Im(z)>0) return ACip4(z);
       return conj(ACip4(conj(z)));
}

Main generator

// In addition to the files arccip.cin and plofu.cin mentioned above, files ado.cin and conto.cin should be stored in the working directory for the compilation of the main code below:

#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;
#define Re(x) x.real()
#define Im(x) x.imag()
#define I z_type(0.,1.)
#include "conto.cin"
#include "acip.cin"
main(){ int j,k,m,n; DB x,y, p,q, t; z_type z,c,d;
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("acipmap.eps","w");ado(o,82,82);
fprintf(o,"41 41 translate\n 10 10 scale\n");
//DO(m,M1) X[m]=-4.+.02*(m-.5);
DO(n,200)Y[n]=-4.+.02*n;
      Y[200]=-.002;
      Y[201]= .002;
for(n=202;n<N1;n++) Y[n]=-4.+.02*(n-1.);
DO(m,M1)X[m]=Y[m];
for(m=-4;m<5;m++){if(m==0){M(m,-4.1)L(m,4.1)} else{M(m,-4)L(m,4)}}
for(n=-4;n<5;n++){     M(  -4,n)L(4,n)}
fprintf(o,".01 W 0 0 0 RGB S\n");
DO(m,M1)DO(n,N1){g[m*N1+n]=9999; f[m*N1+n]=9999;}
DO(m,M1){x=X[m]; //printf("%5.2f\n",x);
DO(n,N1){y=Y[n]; z=z_type(x,y);
        c=ACip5(z);
//      c=ACip3(z);
//      d=ACip1(z);
//     p=abs((c-d)/(c+d));  p=-log(p)/log(10.);
       p=Re(c);
       q=Im(c);        
       if(p>-99. && p<99.
        &&     q>-99. && q<99 
       )
       {g[m*N1+n]=p; 
        f[m*N1+n]=q;
        }
                       }}
//#include "plodi.cin" 
#include "plofu.cin"
DB x1=-0.33650841691839534; 
DB y1= 1.55;
M(-4.02,0)L(x1,0)
M(0,-4.02)L(0,-y1) M(0,y1)L(0,4.02)
fprintf(o,"0 setlinecap .028 W .9 1 .9 RGB S\n");
DO(m,37){x=x1-.1*m; M(x,0) L(x-.05,0)}
DO(n,25){y=-y1-.1*n; M(0,y) L(0,y-.05)}
DO(n,25){y=y1+.1*n; M(0,y) L(0,y+.05)}
fprintf(o,".032 W 0 0 0 RGB S\n");
fprintf(o,"showpage\n%c%cTrailer",'%','%'); fclose(o);
      system("epstopdf acipmap.eps");
      system(    "open acipmap.pdf");            
      getchar(); system("killall Preview");//for mac
}

Latex generator of lables

%<br> \documentclass[12pt]{article} %<br> \paperheight 838px %<br> \paperwidth 844px %<br> \textwidth 1294px %<br> \textheight 1200px %<br> \topmargin -80px %<br> \oddsidemargin -80px %<br> \usepackage{graphics} %<br> \usepackage{rotating} %<br> \newcommand \sx {\scalebox} %<br> \newcommand \rot {\begin{rotate}} %<br> \newcommand \ero {\end{rotate}} %<br> \newcommand \ing {\includegraphics} %<br> \newcommand \rmi {\mathrm{i}} %<br> \begin{document} %<br> \newcommand \zoomax { %<br> \put(16,820){\sx{4.4}{$y$}} %<br> \put(16,630){\sx{4}{$2$}} %<br> \put(16,430){\sx{4}{$0$}} %<br> \put(-4, 230){\sx{4}{$-\!2$}} %<br> \put(220, 5){\sx{4}{$-\!2$}} %<br> \put(443, 5){\sx{4}{$0$}} %<br> \put(643, 5){\sx{4}{$2$}} %<br> \put(831,6){\sx{4}{$x$}} %<br> } %<br> \parindent 0pt %<br> %\sx{8}{\begin{picture}(86,86) \put(0,0){\ing{b271t0}} %<br> \begin{picture}(816,816) %<br> \put(40,30){\sx{10}{\ing{acipmap}}} %<br> \zoomax %<br> \put(130,806){\sx{4}{\rot{-42}$u\!=\!1$\ero}} %<br> \put(90,750){\sx{4}{\rot{-33}$u\!=\!1.2$\ero}} %<br> \put(70,680){\sx{4}{\rot{-26}$u\!=\!1.4$\ero}} %<br> \put(60,484){\sx{4}{\rot{2}$u\!=\!2$\ero}} %<br> \put(60,431){\sx{4}{\bf cut}} %<br> \put(460,690){\sx{4}{\rot{90}\bf cut \ero}} %<br> \put(460,120){\sx{4}{\rot{90}\bf cut \ero}} %<br> \put(60,377){\sx{4}{\rot{-3}$u\!=\!2$\ero}} %<br> \put(130,90){\sx{4}{\rot{42}$u\!=\!1$\ero}} %<br> %<br> \put(310,744){\sx{4}{\rot{22}$v\!=\!-3$\ero}} %<br> \put(370,588){\sx{4}{\rot{34}$v\!=\!-2$\ero}} %<br> \put(290,160){\sx{4}{\rot{-22}$v\!=\!3$\ero}} %<br> %<br> \put(720,708){\sx{4}{\rot{-21}$u\!=\!0.2$\ero}} %<br> \put(750,431){\sx{4}{\rot{00}$v\!=\!0$\ero}} %<br> \put(726,148){\sx{4}{\rot{21}$u\!=\!0.2$\ero}} %<br> %<br> \put(680,550){\sx{3.8}{\rot{68}$v\!=\!0.2$\ero}} %<br> \put(644,330){\sx{3.7}{\rot{-68}$v\!=\!-0.2$\ero}} %<br> %<br> \end{picture} %<br> \end{document} %<br> %

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current17:50, 20 June 2013Thumbnail for version as of 17:50, 20 June 2013844 × 838 (199 KB)Maintenance script (talk | contribs)Importing image file

The following page uses this file: