Difference between revisions of "File:SuZexPlot511T.jpg"

From TORI
Jump to navigation Jump to search
(Importing image file)
 
Line 1: Line 1:
  +
[[Explicit plot]] of function [[SuZex]] in comparison to its transfer function [[zex]].
Importing image file
 
  +
  +
==[[C++]] generator of curves==
  +
  +
  +
// Files [[ado.cin]]. [[SuZexCoef20.cin]], [[SuZexTay2008co.cin]], [[SuZexTay0co.cin]], [[SuZex.cin]]
  +
  +
//should be loaded to the working directory in order to compile the 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.)
  +
  +
/*
  +
z_type zex(z_type z) { return z*exp(z);}
  +
  +
z_type suzexo(z_type z){ int n,m; z_type L=log(-z); z_type c[21]; z_type s;
  +
#include "SuZexCoef20.cin"
  +
c[0]=-1.; c[1]=.5*L;
  +
for(n=2;n<21;n++){ s=a[n][n];
  +
for(m=n-1; m>=0; m--){ s*=L; s+=a[n][m]; }
  +
c[n]=s; }
  +
s=c[20]/z; for(n=19;n>=0;n--){ s+=c[n]; s/=z;}
  +
return s; }
  +
  +
z_type suzex2008t12(z_type z){ int n,m=80; z_type s;
  +
#include "SuZexTay2008co.cin"
  +
s=c[m]; for(n=m-1;n>=0;n--){ s*=z; s+=c[n];}
  +
return s;}
  +
  +
z_type SuZexTay0(z_type z){ int n,m=96; z_type s;
  +
#include "SuZexTay0co.cin"
  +
s=SuZexTay0co[m]; for(n=m-1;n>=0;n--){ s*=z; s+=SuZexTay0co[n];}
  +
return s;}
  +
  +
z_type suzex(z_type z){int m,n; z_type s;
  +
if( abs(z) < 1.6 ) return SuZexTay0(z) ; // I made the Taylor expansion for this case
  +
if( Re(z)>0 && fabs(Im(z))<1.5){n=int(Re(z)+.5); s=SuZexTay0(z-(0.+n)); DO(m,n) s=zex(s); return s;}
  +
z+=-1.1259817765745026; // WARNING! ARGUEMENT CHANGES ITS VALUE!
  +
if( abs(z+12.) < 8.1 ) return suzex2008t12(z+12.) ; // I made the Taylor expansion for this case
  +
if( Re(z)<-12. || fabs(Im(z)) > 8. ) return suzexo(z); // definitely, |z|>8
  +
n= int(Re(z)+12.); s=suzex2008t12(z+12.-(0.+n)); DO(m,n) s=zex(s); return s;
  +
}
  +
// Copyleft 2012 by Dmitrii Kouznetsov
  +
*/
  +
  +
#include "SuZex.cin"
  +
  +
#include "ado.cin"
  +
#define M(x,y) fprintf(o,"%6.4f %6.4f M\n",0.+x,0.+y);
  +
#define L(x,y) fprintf(o,"%6.4f %6.4f L\n",0.+x,0.+y);
  +
  +
main(){ int j,k,m,n; DB x,y, p,q, t; z_type z,c,d, cu,cd;
  +
DB x1=-1.1259817765745026; //DO(n,8){ y=Re(suzex(x1)); x=y-1.; x1+=-1.2*x; printf("%18.16f %18.16f\n", x1,y);} getchar();
  +
FILE *o;o=fopen("SuZexPlot511.eps","w"); ado(o,504,1104);
  +
fprintf(o,"303 101 translate\n 100 100 scale\n");
  +
fprintf(o,"1 setlinejoin 2 setlinecap\n");
  +
for(m=-3;m<3;m++) {M(m,-1)L(m,16)}
  +
for(n=-1;n<17;n++) {M(-3,n)L(2,n)}
  +
M(0,M_E)L(1,M_E)
  +
M(0,-1./M_E)L(-1,-1./M_E)
  +
fprintf(o,".006 W S\n");
  +
//
  +
DO(m,130){x=-3.02 +.1*m; y=Re(suzex(x)); if(m==0) M(x,y) else L(x,y) if(y>10) break;} fprintf(o,".03 W 0 0 1 RGB S\n");
  +
// DO(m,130){x=-10.+.1*m; y=-1./(x+x1); if(m==0) M(x,y) else L(x,y) if(y>10) break;} fprintf(o,".01 W 0 0 0 RGB S\n");
  +
// DO(m,130){x=-2.+.1*m; y=exp(x); if(m==0) M(x,y) else L(x,y) if(y>10) break;} fprintf(o,".01 W .5 0 0 RGB S\n");
  +
DO(m,130){x=-3.02+.1*m; y=Re(zex(x)); if(m==0) M(x,y) else L(x,y) if(y>10) break;} fprintf(o,".01 W 0 0 0 RGB S\n");
  +
//
  +
fprintf(o,"showpage\n"); fprintf(o,"%c%cTrailer\n",'%','%'); fclose(o);
  +
system("epstopdf SuZexPlot511.eps");
  +
system( "open SuZexPlot511.pdf"); //for macintosh
  +
getchar(); system("killall Preview"); // For macintosh
  +
}
  +
==[[Latex]] generator of labels==
  +
%<nowiki> %<br>
  +
% file SuZexPlot.pdf should be generated with the code above in order to compile the Latex document below. %<br>
  +
% Copyleft 2012 by Dmitrii Kouznetsov <br> %
  +
\documentclass[12pt]{article} % <br>
  +
\usepackage{geometry} % <br>
  +
\usepackage{graphicx} % <br>
  +
\usepackage{rotating} % <br>
  +
\paperwidth 508pt % <br>
  +
\paperheight 1104pt % <br>
  +
\topmargin -96pt % <br>
  +
\oddsidemargin -81pt % <br>
  +
\textwidth 1200pt % <br>
  +
\textheight 1200pt % <br>
  +
\pagestyle {empty} % <br>
  +
\newcommand \sx {\scalebox} % <br>
  +
\newcommand \rot {\begin{rotate}} % <br>
  +
\newcommand \ero {\end{rotate}} % <br>
  +
\newcommand \ing {\includegraphics} % <br>
  +
\parindent 0pt% <br>
  +
\pagestyle{empty} % <br>
  +
\begin{document} % <br>
  +
\begin{picture}(1202,1102) % <br>
  +
%\put(10,10){\ing{ExpQ2plot}} % <br>
  +
\put(322,1090){\sx{4}{$y$}} % <br>
  +
\put(292,372){\sx{4}{$\mathrm e$}} % <br>
  +
\put(315, 62){\sx{4}{$-\!1/\mathrm e$}} % <br>
  +
\put(325,998){\sx{4}{$9$}} % <br>
  +
\put(325,898){\sx{4}{$8$}} % <br>
  +
\put(325,798){\sx{4}{$7$}} % <br>
  +
\put(325,698){\sx{4}{$6$}} % <br>
  +
\put(325,598){\sx{4}{$5$}} % <br>
  +
\put(325,498){\sx{4}{$4$}} % <br>
  +
\put(325,398){\sx{4}{$3$}} % <br>
  +
\put(325,298){\sx{4}{$2$}} % <br>
  +
\put(325,198){\sx{4}{$1$}} % <br>
  +
%\put(325,098){\sx{4}{$0$}} % <br>
  +
% <br>
  +
\put(078,116){\sx{4}{$-\!2$}} % <br>
  +
\put(178,116){\sx{4}{$-\!1$}} % <br>
  +
\put(304,116){\sx{4}{$0$}} % <br>
  +
\put(404,116){\sx{4}{$1$}} % <br>
  +
\put(490,116){\sx{4}{$x$}} % <br>
  +
% <br>
  +
\put(12,188){\sx{4}{\rot{0}$y\!=\!\mathrm{SuZex}(x)$\ero}} % <br>
  +
\put(358,162){\sx{4}{\rot{0}$y\!=\!x\mathrm{e}^x$\ero}} % <br>
  +
%\put(10,10){\ing{ExpQ2plot}} % <br>
  +
\put(10,10){\ing{SuZexPlot511}} % <br>
  +
\end{picture} % <br>
  +
\end{document} % <br>
  +
%</nowiki>
  +
  +
[[Category:SuZex]]
  +
[[Category:Zex]]
  +
[[Category:Superfunction]]
  +
[[Category:Explicit plot]]
  +
[[Category:C++]]
  +
[[Category:Latex]]

Revision as of 09:43, 21 June 2013

Explicit plot of function SuZex in comparison to its transfer function zex.

C++ generator of curves

// Files ado.cin. SuZexCoef20.cin, SuZexTay2008co.cin, SuZexTay0co.cin, SuZex.cin

//should be loaded to the working directory in order to compile the 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.)

/*

z_type zex(z_type z) { return z*exp(z);}
z_type suzexo(z_type z){ int n,m; z_type L=log(-z); z_type c[21]; z_type s;
#include "SuZexCoef20.cin"
c[0]=-1.; c[1]=.5*L;
for(n=2;n<21;n++){ s=a[n][n]; 
                   for(m=n-1; m>=0; m--){ s*=L; s+=a[n][m]; }
                   c[n]=s; }
s=c[20]/z; for(n=19;n>=0;n--){ s+=c[n]; s/=z;}
return s; }
 z_type suzex2008t12(z_type z){ int n,m=80; z_type s;
 #include "SuZexTay2008co.cin"
 s=c[m]; for(n=m-1;n>=0;n--){ s*=z; s+=c[n];}
 return s;}
 z_type SuZexTay0(z_type z){ int n,m=96; z_type s;
 #include "SuZexTay0co.cin"
 s=SuZexTay0co[m]; for(n=m-1;n>=0;n--){ s*=z; s+=SuZexTay0co[n];}
 return s;}
z_type suzex(z_type z){int m,n; z_type s;
if( abs(z) < 1.6 )                   return SuZexTay0(z) ; // I made the Taylor expansion for this case
if( Re(z)>0 && fabs(Im(z))<1.5){n=int(Re(z)+.5); s=SuZexTay0(z-(0.+n)); DO(m,n) s=zex(s); return s;}
 z+=-1.1259817765745026;     // WARNING! ARGUEMENT CHANGES ITS VALUE!
if( abs(z+12.) < 8.1 )               return suzex2008t12(z+12.) ; // I made the Taylor expansion for this case
if( Re(z)<-12. || fabs(Im(z)) > 8. ) return suzexo(z); // definitely, |z|>8
n= int(Re(z)+12.); s=suzex2008t12(z+12.-(0.+n)); DO(m,n) s=zex(s); return s;
} 
// Copyleft 2012 by Dmitrii Kouznetsov
*/
#include "SuZex.cin"

#include "ado.cin"
#define M(x,y) fprintf(o,"%6.4f %6.4f M\n",0.+x,0.+y);
#define L(x,y) fprintf(o,"%6.4f %6.4f L\n",0.+x,0.+y);
main(){ int j,k,m,n; DB x,y, p,q, t; z_type z,c,d, cu,cd;
DB x1=-1.1259817765745026; //DO(n,8){ y=Re(suzex(x1)); x=y-1.; x1+=-1.2*x; printf("%18.16f %18.16f\n", x1,y);} getchar();
FILE *o;o=fopen("SuZexPlot511.eps","w");  ado(o,504,1104);
fprintf(o,"303 101 translate\n 100 100 scale\n");
fprintf(o,"1 setlinejoin 2 setlinecap\n");
for(m=-3;m<3;m++) {M(m,-1)L(m,16)}
for(n=-1;n<17;n++) {M(-3,n)L(2,n)}
M(0,M_E)L(1,M_E)
M(0,-1./M_E)L(-1,-1./M_E)
fprintf(o,".006 W S\n");
//
DO(m,130){x=-3.02 +.1*m; y=Re(suzex(x)); if(m==0) M(x,y) else L(x,y) if(y>10) break;}  fprintf(o,".03 W 0 0 1 RGB S\n");
// DO(m,130){x=-10.+.1*m; y=-1./(x+x1);   if(m==0) M(x,y) else L(x,y) if(y>10) break;}  fprintf(o,".01 W 0 0 0 RGB S\n");
// DO(m,130){x=-2.+.1*m; y=exp(x);       if(m==0) M(x,y) else L(x,y) if(y>10) break;}  fprintf(o,".01 W .5 0 0 RGB S\n");
 DO(m,130){x=-3.02+.1*m; y=Re(zex(x));    if(m==0) M(x,y) else L(x,y) if(y>10) break;}  fprintf(o,".01 W 0 0 0 RGB S\n");
//
fprintf(o,"showpage\n"); fprintf(o,"%c%cTrailer\n",'%','%');  fclose(o);
      system("epstopdf SuZexPlot511.eps"); 
      system(    "open SuZexPlot511.pdf"); //for macintosh
      getchar(); system("killall Preview"); // For macintosh
}

Latex generator of labels

% %<br> % file SuZexPlot.pdf should be generated with the code above in order to compile the Latex document below. %<br> % Copyleft 2012 by Dmitrii Kouznetsov <br> % \documentclass[12pt]{article} % <br> \usepackage{geometry} % <br> \usepackage{graphicx} % <br> \usepackage{rotating} % <br> \paperwidth 508pt % <br> \paperheight 1104pt % <br> \topmargin -96pt % <br> \oddsidemargin -81pt % <br> \textwidth 1200pt % <br> \textheight 1200pt % <br> \pagestyle {empty} % <br> \newcommand \sx {\scalebox} % <br> \newcommand \rot {\begin{rotate}} % <br> \newcommand \ero {\end{rotate}} % <br> \newcommand \ing {\includegraphics} % <br> \parindent 0pt% <br> \pagestyle{empty} % <br> \begin{document} % <br> \begin{picture}(1202,1102) % <br> %\put(10,10){\ing{ExpQ2plot}} % <br> \put(322,1090){\sx{4}{$y$}} % <br> \put(292,372){\sx{4}{$\mathrm e$}} % <br> \put(315, 62){\sx{4}{$-\!1/\mathrm e$}} % <br> \put(325,998){\sx{4}{$9$}} % <br> \put(325,898){\sx{4}{$8$}} % <br> \put(325,798){\sx{4}{$7$}} % <br> \put(325,698){\sx{4}{$6$}} % <br> \put(325,598){\sx{4}{$5$}} % <br> \put(325,498){\sx{4}{$4$}} % <br> \put(325,398){\sx{4}{$3$}} % <br> \put(325,298){\sx{4}{$2$}} % <br> \put(325,198){\sx{4}{$1$}} % <br> %\put(325,098){\sx{4}{$0$}} % <br> % <br> \put(078,116){\sx{4}{$-\!2$}} % <br> \put(178,116){\sx{4}{$-\!1$}} % <br> \put(304,116){\sx{4}{$0$}} % <br> \put(404,116){\sx{4}{$1$}} % <br> \put(490,116){\sx{4}{$x$}} % <br> % <br> \put(12,188){\sx{4}{\rot{0}$y\!=\!\mathrm{SuZex}(x)$\ero}} % <br> \put(358,162){\sx{4}{\rot{0}$y\!=\!x\mathrm{e}^x$\ero}} % <br> %\put(10,10){\ing{ExpQ2plot}} % <br> \put(10,10){\ing{SuZexPlot511}} % <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 20131,055 × 2,292 (188 KB)Maintenance script (talk | contribs)Importing image file

The following 2 pages use this file:

Metadata