Difference between revisions of "File:DoyaPlotT100.png"

From TORI
Jump to navigation Jump to search
(Importing image file)
 
Line 1: Line 1:
  +
[[Explicit plot]] of the [[Doya function]]
Importing image file
 
  +
  +
$ \mathrm{Doya}_t(z)=\mathrm{Tania}(t+\mathrm{ArcTania}(z))$
  +
  +
where the [[Tania function]] is solution of equations
  +
  +
$\displaystyle \mathrm{Tania}'(z)=
  +
\frac{ \mathrm{Tania}(z)}{1\!+\!\mathrm{Tania}(z)}~$, $~\mathrm{Tania}(0)\!=\!1$
  +
  +
At the picture,
  +
$y=\mathrm{Doya}_t(x)$ is plotted versus $x$ for various values of $t$.
  +
  +
==Generators==
  +
The curves are generated with the [[C++]] code.
  +
The resulting file is imported into the [[Latex]] document for generation of labels.
  +
===[[C++]] generator of curves===
  +
  +
<!-- File [[ado.cin]] should be loaded to the working directory for the compilation of 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 ArcTania(z_type z) {return z + log(z) - 1. ;}
  +
  +
z_type ArcTaniap(z_type z) {return 1. + 1./z ;}
  +
  +
z_type TaniaTay(z_type z) { int n; z_type s;
  +
s=1.+z*(.5+z*(1./16.+z*(-1./192.+z*(-1./3072.+z*(1.3/6144.+z*(-4.7/147456.
  +
//+z*(7.3/4128768.) //some reserve term
  +
)))))); DO(n,3) s+=(z-ArcTania(s))/ArcTaniap(s); return s ; }
  +
  +
z_type TaniaNega(z_type z){int n;z_type s=exp(z-exp(z)+1.);
  +
DO(n,4) s+=(z-ArcTania(s))/ArcTaniap(s); return s ; }
  +
  +
z_type TaniaBig(z_type z){int n;z_type s=z; s=z-log(s)+1.;
  +
DO(n,3) s+=(z-ArcTania(s))/ArcTaniap(s); return s ; }
  +
z_type TaniaS(z_type z){int n; z_type s,t=z+z_type(2.,-M_PI);t*=2./9.; t=I*sqrt(t);
  +
s=-1.+t*(3.+t*(-3.+t*(.75+t*(.3+t*(.9/16.+t*(-.3/7.+t*(-12.51/224. //+t*(-.9/28.)
  +
)))))));
  +
DO(n,3) s+=(z-ArcTania(s))/ArcTaniap(s); return s ; }
  +
  +
z_type Tania(z_type z){ z_type t;
  +
if( fabs(Im(z))< M_PI && Re(z)<-2.51) return TaniaNega(z);
  +
if( abs(z)>7. || Re(z)>3.8 ) return TaniaBig(z);
  +
if( Im(z) > .7 ) return TaniaS(z);
  +
if( Im(z) < -.7) return conj(TaniaS(conj(z)));
  +
return TaniaTay(z);
  +
}
  +
  +
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,"/C {closepath} bind def\n");
  +
fprintf(O,"/F {fill} bind def\n");
  +
fprintf(O,"/o {.1 0 360 arc C S} bind def\n");
  +
fprintf(O,"/times-Roman findfont 20 scalefont setfont\n");
  +
fprintf(O,"/W {setlinewidth} bind def\n");
  +
fprintf(O,"/RGB {setrgbcolor} bind def\n");}
  +
  +
#define M(x,y) fprintf(o,"%6.3f %6.3f M\n",0.+x,0.+y);
  +
#define L(x,y) fprintf(o,"%6.3f %6.3f L\n",0.+x,0.+y);
  +
  +
main(){ int j,k,m,n; DB x,y, a;
  +
FILE *o;o=fopen("doyaplot.eps","w");ado(o,408,408);
  +
fprintf(o,"4 4 translate\n 100 100 scale\n");
  +
for(m=0;m<5;m++){ M(m,0)L(m,4)}
  +
for(n=0;n<5;n++){ M(0,n)L(4,n)}
  +
M(0,0)L(4,4)
  +
fprintf(o,".01 W 0 0 0 RGB S\n");
  +
DO(n,181){x=.005+.01*n;y=Re(Tania(3.+ArcTania(x)));if(n==0)M(x,y)else L(x,y)} fprintf(o,".02 W 0 0 .5 RGB S\n");
  +
DO(n,249){x=.005+.01*n;y=Re(Tania(2.+ArcTania(x)));if(n==0)M(x,y)else L(x,y)} fprintf(o,".02 W 0 0 .5 RGB S\n");
  +
DO(n,163){x=.005+.02*n;y=Re(Tania(1.+ArcTania(x)));if(n==0)M(x,y)else L(x,y)} fprintf(o,".02 W 0 0 .5 RGB S\n");
  +
DO(n,101){x=.005+.04*n;y=Re(Tania(-1.+ArcTania(x)));if(n==0)M(x,y)else L(x,y)} fprintf(o,".02 W .5 0 0 RGB S\n");
  +
DO(n,101){x=.005+.04*n;y=Re(Tania(-2.+ArcTania(x)));if(n==0)M(x,y)else L(x,y)} fprintf(o,".02 W .5 0 0 RGB S\n");
  +
DO(n,101){x=.005+.04*n;y=Re(Tania(-3.+ArcTania(x)));if(n==0)M(x,y)else L(x,y)} fprintf(o,".02 W .5 0 0 RGB S\n");
  +
fprintf(o,"showpage\n%cTrailer",'%'); fclose(o);
  +
system("epstopdf doyaplot.eps");
  +
system( "open doyaplot.pdf"); //these 2 commands may be specific for macintosh
  +
getchar(); system("killall Preview");// if run at another operational sysetm, may need to modify
  +
}
  +
  +
===[[Latex]] generator of the picture===
  +
<nowiki>
  +
  +
\documentclass[12pt]{article} %<br>
  +
\usepackage{geometry} %<br>
  +
\usepackage{graphicx} %<br>
  +
\usepackage{rotating} %<br>
  +
\paperwidth 419pt %<br>
  +
\paperheight 426pt %<br>
  +
\topmargin -103pt %<br>
  +
\oddsidemargin -83pt %<br>
  +
\textwidth 1200pt %<br>
  +
\textheight 600pt %<br>
  +
\pagestyle {empty} %<br>
  +
\newcommand \sx {\scalebox} %<br>
  +
\newcommand \rot {\begin{rotate}} %<br>
  +
\newcommand \ero {\end{rotate}} %<br>
  +
\newcommand \ing {\includegraphics} %<br>
  +
\begin{document} %<br>
  +
\sx{1}{ \begin{picture}(810,410) %<br>
  +
\put(1,9){\ing{doyaplot}} % <br>
  +
\put(-12,394){\sx{2.8}{$y$}} % <br>
  +
\put(-12,303){\sx{2.8}{$3$}} % <br>
  +
\put(-12,203){\sx{2.8}{$2$}} % <br>
  +
\put(-12,103){\sx{2.8}{$1$}} % <br>
  +
\put(0,-9){\sx{2.5}{$0$}} % <br>
  +
\put(100,-9){\sx{2.5}{$1$}} % <br>
  +
\put(200,-9){\sx{2.5}{$2$}} % <br>
  +
\put(300,-9){\sx{2.5}{$3$}} % <br>
  +
\put(392,-7){\sx{2.6}{$x$}} % <br>
  +
%\put(560,214){\rot{37}\sx{4}{$y=\mathrm{Tania}(x)$}\ero} % <br>
  +
\put(134,353){\rot{53}\sx{2.8}{$t\!=\!3$}\ero} %<br>
  +
\put(194,354){\rot{50}\sx{2.8}{$t\!=\!2$}\ero} %<br>
  +
\put(260,350){\rot{48}\sx{2.8}{$t\!=\!1$}\ero} %<br>
  +
\put(336,350){\rot{45}\sx{2.8}{$t\!=\!0$}\ero} %<br>
  +
\put(340,238){\rot{44}\sx{2.8}{$t\!=\!-1$}\ero} %<br>
  +
\put(344,178){\rot{41}\sx{2.7}{$t\!=\!-2$}\ero} %<br>
  +
\put(341,114){\rot{37}\sx{2.7}{$t\!=\!-3$}\ero} %<br>
  +
\end{picture} %<br>
  +
} %<br>
  +
\end{document}
  +
</nowiki>
  +
  +
==Copyleft status==
  +
This picture and its generators can be used for free; attribute the source.
  +
  +
[[Category:Tania function]]
  +
[[Category:Doya function]]
  +
[[Category:Laser science]]
  +
[[Category:Transfer function]]
  +
[[Category:TORI]]

Revision as of 20:24, 20 June 2013

Explicit plot of the Doya function

$ \mathrm{Doya}_t(z)=\mathrm{Tania}(t+\mathrm{ArcTania}(z))$

where the Tania function is solution of equations

$\displaystyle \mathrm{Tania}'(z)= \frac{ \mathrm{Tania}(z)}{1\!+\!\mathrm{Tania}(z)}~$, $~\mathrm{Tania}(0)\!=\!1$

At the picture, $y=\mathrm{Doya}_t(x)$ is plotted versus $x$ for various values of $t$.

Generators

The curves are generated with the C++ code. The resulting file is imported into the Latex document for generation of labels.

C++ generator of curves

#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 ArcTania(z_type z) {return z + log(z) - 1. ;}
z_type ArcTaniap(z_type z) {return 1. + 1./z ;}
z_type TaniaTay(z_type z) { int n; z_type s;
s=1.+z*(.5+z*(1./16.+z*(-1./192.+z*(-1./3072.+z*(1.3/6144.+z*(-4.7/147456.
//+z*(7.3/4128768.) //some reserve term
)))))); DO(n,3) s+=(z-ArcTania(s))/ArcTaniap(s); return s ; }
z_type TaniaNega(z_type z){int n;z_type s=exp(z-exp(z)+1.);
DO(n,4) s+=(z-ArcTania(s))/ArcTaniap(s); return s ; }
z_type TaniaBig(z_type z){int n;z_type s=z; s=z-log(s)+1.;
DO(n,3) s+=(z-ArcTania(s))/ArcTaniap(s); return s ; }
z_type TaniaS(z_type z){int n; z_type s,t=z+z_type(2.,-M_PI);t*=2./9.; t=I*sqrt(t);
s=-1.+t*(3.+t*(-3.+t*(.75+t*(.3+t*(.9/16.+t*(-.3/7.+t*(-12.51/224. //+t*(-.9/28.)
))))))); 
DO(n,3) s+=(z-ArcTania(s))/ArcTaniap(s); return s ; }
z_type Tania(z_type z){ z_type t;
if( fabs(Im(z))< M_PI && Re(z)<-2.51) return TaniaNega(z);
if( abs(z)>7. || Re(z)>3.8 ) return TaniaBig(z);
if( Im(z) > .7 ) return TaniaS(z);
if( Im(z) < -.7) return conj(TaniaS(conj(z)));
return TaniaTay(z);
}
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,"/C {closepath} bind def\n");
      fprintf(O,"/F {fill} bind def\n");
      fprintf(O,"/o {.1 0 360 arc C S} bind def\n");
      fprintf(O,"/times-Roman findfont 20 scalefont setfont\n");
      fprintf(O,"/W {setlinewidth} bind def\n");
      fprintf(O,"/RGB {setrgbcolor} bind def\n");}
#define M(x,y) fprintf(o,"%6.3f %6.3f M\n",0.+x,0.+y);
#define L(x,y) fprintf(o,"%6.3f %6.3f L\n",0.+x,0.+y);
main(){ int j,k,m,n; DB x,y, a;
FILE *o;o=fopen("doyaplot.eps","w");ado(o,408,408);
fprintf(o,"4 4 translate\n 100 100 scale\n");
for(m=0;m<5;m++){ M(m,0)L(m,4)}
for(n=0;n<5;n++){ M(0,n)L(4,n)}
M(0,0)L(4,4)
fprintf(o,".01 W 0 0 0 RGB S\n");
DO(n,181){x=.005+.01*n;y=Re(Tania(3.+ArcTania(x)));if(n==0)M(x,y)else L(x,y)} fprintf(o,".02 W 0 0 .5 RGB S\n");
DO(n,249){x=.005+.01*n;y=Re(Tania(2.+ArcTania(x)));if(n==0)M(x,y)else L(x,y)} fprintf(o,".02 W 0 0 .5 RGB S\n");
DO(n,163){x=.005+.02*n;y=Re(Tania(1.+ArcTania(x)));if(n==0)M(x,y)else L(x,y)} fprintf(o,".02 W 0 0 .5 RGB S\n");
DO(n,101){x=.005+.04*n;y=Re(Tania(-1.+ArcTania(x)));if(n==0)M(x,y)else L(x,y)} fprintf(o,".02 W .5 0 0 RGB S\n");
DO(n,101){x=.005+.04*n;y=Re(Tania(-2.+ArcTania(x)));if(n==0)M(x,y)else L(x,y)} fprintf(o,".02 W .5 0 0 RGB S\n");
DO(n,101){x=.005+.04*n;y=Re(Tania(-3.+ArcTania(x)));if(n==0)M(x,y)else L(x,y)} fprintf(o,".02 W .5 0 0 RGB S\n");
fprintf(o,"showpage\n%cTrailer",'%'); fclose(o);
     system("epstopdf doyaplot.eps");
     system(    "open doyaplot.pdf"); //these 2 commands may be specific for macintosh
getchar(); system("killall Preview");// if run at another operational sysetm, may need to modify
}

Latex generator of the picture

\documentclass[12pt]{article} %<br> \usepackage{geometry} %<br> \usepackage{graphicx} %<br> \usepackage{rotating} %<br> \paperwidth 419pt %<br> \paperheight 426pt %<br> \topmargin -103pt %<br> \oddsidemargin -83pt %<br> \textwidth 1200pt %<br> \textheight 600pt %<br> \pagestyle {empty} %<br> \newcommand \sx {\scalebox} %<br> \newcommand \rot {\begin{rotate}} %<br> \newcommand \ero {\end{rotate}} %<br> \newcommand \ing {\includegraphics} %<br> \begin{document} %<br> \sx{1}{ \begin{picture}(810,410) %<br> \put(1,9){\ing{doyaplot}} % <br> \put(-12,394){\sx{2.8}{$y$}} % <br> \put(-12,303){\sx{2.8}{$3$}} % <br> \put(-12,203){\sx{2.8}{$2$}} % <br> \put(-12,103){\sx{2.8}{$1$}} % <br> \put(0,-9){\sx{2.5}{$0$}} % <br> \put(100,-9){\sx{2.5}{$1$}} % <br> \put(200,-9){\sx{2.5}{$2$}} % <br> \put(300,-9){\sx{2.5}{$3$}} % <br> \put(392,-7){\sx{2.6}{$x$}} % <br> %\put(560,214){\rot{37}\sx{4}{$y=\mathrm{Tania}(x)$}\ero} % <br> \put(134,353){\rot{53}\sx{2.8}{$t\!=\!3$}\ero} %<br> \put(194,354){\rot{50}\sx{2.8}{$t\!=\!2$}\ero} %<br> \put(260,350){\rot{48}\sx{2.8}{$t\!=\!1$}\ero} %<br> \put(336,350){\rot{45}\sx{2.8}{$t\!=\!0$}\ero} %<br> \put(340,238){\rot{44}\sx{2.8}{$t\!=\!-1$}\ero} %<br> \put(344,178){\rot{41}\sx{2.7}{$t\!=\!-2$}\ero} %<br> \put(341,114){\rot{37}\sx{2.7}{$t\!=\!-3$}\ero} %<br> \end{picture} %<br> } %<br> \end{document}

Copyleft status

This picture and its generators can be used for free; attribute the source.

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 2013580 × 590 (77 KB)Maintenance script (talk | contribs)Importing image file

The following 2 pages use this file:

Metadata