Difference between revisions of "File:Modeabso25T.png"

From TORI
Jump to navigation Jump to search
(Importing image file)
 
 
Line 1: Line 1:
  +
'''Assembling of the principal mode of a wave guided between the absorbing walls'''.
Importing image file
 
  +
The graphics correspond to the [[damping parameter]] $\alpha=0.25$,
  +
  +
In the central part, mode
  +
: $ f=\cos(pz)$
  +
in the lateral part,
  +
: $ f= r \exp\!\Big( - q \big(|x|-d\big) \Big)$
  +
where $d$ is half-width of waveguide.
  +
  +
Parameters $p$, $q$ and $r$ expressed through functions [[ArcCosq]]=[[acosq]] and [[ArcCosqq]] as follows:
  +
: $ pd = \text{acosq}(\alpha) \approx 1.30652013112871 -0.20108562381528 \, \mathrm i$
  +
: $ qd = \text{acosqq}(\alpha) \approx 2.63604614403057 -2.93518290714528 \, \mathrm i$
  +
: $ ~ r = \cos(pd) \approx 0.26650956316919 + 0.19541505906974\, \mathrm i$
  +
  +
==C++ generator of curves==
  +
// Files [[ado.cin]] and [[acosc.cin]] should be loaded in the working directory for the compilation of the [[C++]] 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 "ado.cin"
  +
//#include "acip.cin" // old name and old, poor implementation
  +
  +
#include "acosc.cin"
  +
  +
z_type acosq(z_type z){ z_type c=z*exp(I*M_PI/4.); c=acosc(c); return c;}
  +
  +
z_type acosqq(z_type z){ z_type c=z*exp(I*M_PI/4.); c=acosc(c); return c*tan(c);}
  +
  +
#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);
  +
#define S(x,y) fprintf(o,"S\n",);
  +
main(){ int j,k,m,n; DB x,y, p,q, t; z_type z,c,d;
  +
DB Sazae= 2.798386045783887; // H
  +
DB Tarao= -0.33650841691839534; // J
  +
DB gamma=.25;
  +
z_type pd= acosq(gamma);
  +
z_type qd= pd*tan(pd);
  +
z_type r = cos(pd);
  +
printf("%19.14lf %19.14lf\n",Re(pd),Im(pd));
  +
printf("%19.14lf %19.14lf\n",Re(qd),Im(qd));
  +
printf("%19.14lf %19.14lf\n",Re(r),Im(r));
  +
FILE *o;o=fopen("modeabso25.eps","w");ado(o,652,224);
  +
fprintf(o,"210 114 translate\n 100 100 scale\n");
  +
for(m=-2;m<5;m++){M(m,-1)L(m,1)}
  +
for(n=-1;n<2;n++){M(-2,n)L(4.4,n)}
  +
fprintf(o,"2 setlinecap .003 W 0 0 0 RGB S\n");
  +
DO(m,630){x=-2.01+.01*m; z=pd*x; y=Re(cos(z)); if(m==0)M(x,y)else L(x,y) }
  +
fprintf(o,"1 setlinejoin 1 setlinecap .01 W 0 0 .8 RGB S\n");
  +
DO(m,642){x=-2.01+.01*m; z=pd*x; y=Im(cos(z)); if(m==0)M(x,y)else L(x,y) }
  +
fprintf(o,"1 setlinejoin 1 setlinecap .01 W .8 0 0 RGB S\n");
  +
DO(m,190){x=-.13-.01*m; z=qd*(fabs(x)-1.); z_type t;t=r*exp(-z);y=Re(t); if(m==0)M(x,y)else L(x,y)}
  +
DO(m,390){x= .13+.01*m; z=qd*(fabs(x)-1.); z_type t;t=r*exp(-z);y=Re(t); if(m==0)M(x,y)else L(x,y)}
  +
// y=Re(r*exp(-z)); // for some reasons the C++ dislikes this
  +
fprintf(o,"1 setlinejoin 1 setlinecap .01 W 0 .7 0 RGB S\n");
  +
DO(m,190){x=-.46-.01*m; z=qd*(fabs(x)-1.); z_type t;t=r*exp(-z);y=Im(t); if(m==0)M(x,y)else L(x,y)}
  +
DO(m,390){x= .46+.01*m; z=qd*(fabs(x)-1.); z_type t;t=r*exp(-z);y=Im(t); if(m==0)M(x,y)else L(x,y)}
  +
fprintf(o,"1 setlinejoin 1 setlinecap .01 W .7 0 .7 RGB S\n");
  +
fprintf(o,"showpage\n%c%cTrailer",'%','%'); fclose(o);
  +
system("epstopdf modeabso25.eps");
  +
system( "open modeabso25.pdf");
  +
getchar(); system("killall Preview");//for mac
  +
}
  +
  +
==Latex generator of labels==
  +
% File [[modeabso25.pdf]] should be generated with the code above in order to compile the [[Latex]] document below.
  +
  +
%<nowiki><br>
  +
% Copyleft 2012 by Dmitrii Kouznetsov %<br>
  +
\documentclass[12pt]{article} %<br>
  +
\usepackage{geometry} %<br>
  +
\usepackage{graphicx} %<br>
  +
\usepackage{rotating} %<br>
  +
%\paperwidth 1612pt %<br>
  +
\paperwidth 1280pt %<br>
  +
\paperheight 436pt %<br>
  +
\topmargin -90pt %<br>
  +
\oddsidemargin -106pt %<br>
  +
\textwidth 900pt %<br>
  +
\textheight 900pt %<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>
  +
\parindent 0pt
  +
%\sx{2}{ \begin{picture}(840,214) %<br>
  +
\sx{2}{ \begin{picture}(600,214) %<br>
  +
\put(4,6){\ing{modeabso25}} %<br>
  +
\put(215,211){\sx{1.6}{$y$}} %<br>
  +
\put(215,114){\sx{1.6}{\bf 0}} %<br>
  +
\put(206, 15){\sx{1.6}{\bf -1}} %<br>
  +
\put(103,104){\sx{1.6}{\bf -1}} %<br>
  +
\put(310,104){\sx{1.6}{\bf 1}} %<br>
  +
\put(410,104){\sx{1.6}{\bf 2}} %<br>
  +
\put(510,104){\sx{1.6}{\bf 3}} %<br>
  +
\put(610,104){\sx{1.6}{\bf 4}} %<br>
  +
\put(629,104){\sx{1.6}{$x\!/\!d$}} %<br>
  +
%\put(790,105){\sx{1.7}{$x$}} %<br>
  +
\put(281,198){\sx{1.3}{\rot{0}$y\!=\!\Re\!\Big(r \exp\!\big(q(|x|\!-\!d)\big)\Big)$\ero}} %<br>
  +
\put(400,148){\sx{1.3}{\rot{0}$y\!=\!\Im\!\Big(\!\cos(px)\Big)$\ero}} %<br>
  +
\put(400, 42){\sx{1.3}{\rot{0}$y\!=\!\Re\!\Big(\!\cos(px)\Big)$\ero}} %<br>
  +
\put(242, 24){\sx{1.3}{\rot{0}$y\!=\!\Im\!\Big(r \exp\!\big(q(|x|\!-\!d)\big)\Big)$\ero}} %<br>
  +
%\put(618, 65){\sx{2.52}{\rot{4}$y\!=\!\Im(\mathrm{acosq}(x))$\ero}} %<br>
  +
\end{picture} %<br>
  +
} %<br>
  +
\end{document}
  +
%</nowiki>
  +
  +
% Copyleft 2012 by Dmitrii Kouznetov
  +
  +
[[Category:ArcCosc]]
  +
[[Category:ArcCosq]]
  +
[[Category:ArcCosqq]]
  +
[[Category:Guiding of waves between absorbing walls]]
  +
[[Category:C++]]
  +
[[Category:Latex]]
  +
[[Category:Explicit plot]]
  +
[[Category:Makoto Morinaga]]

Latest revision as of 09:41, 21 June 2013

Assembling of the principal mode of a wave guided between the absorbing walls. The graphics correspond to the damping parameter $\alpha=0.25$,

In the central part, mode

$ f=\cos(pz)$

in the lateral part,

$ f= r \exp\!\Big( - q \big(|x|-d\big) \Big)$

where $d$ is half-width of waveguide.

Parameters $p$, $q$ and $r$ expressed through functions ArcCosq=acosq and ArcCosqq as follows:

$ pd = \text{acosq}(\alpha) \approx 1.30652013112871 -0.20108562381528 \, \mathrm i$
$ qd = \text{acosqq}(\alpha) \approx 2.63604614403057 -2.93518290714528 \, \mathrm i$
$ ~ r = \cos(pd) \approx 0.26650956316919 + 0.19541505906974\, \mathrm i$

C++ generator of curves

// Files ado.cin and acosc.cin should be loaded in the working directory for the compilation of the C++ 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 "ado.cin"
//#include "acip.cin" // old name and old, poor implementation
#include "acosc.cin"
z_type acosq(z_type z){ z_type c=z*exp(I*M_PI/4.); c=acosc(c); return c;}
z_type acosqq(z_type z){ z_type c=z*exp(I*M_PI/4.); c=acosc(c); return c*tan(c);}
#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);
#define S(x,y) fprintf(o,"S\n",);
main(){ int j,k,m,n; DB x,y, p,q, t; z_type z,c,d;
DB Sazae= 2.798386045783887; // H
DB Tarao= -0.33650841691839534; // J
DB gamma=.25;
z_type pd= acosq(gamma);
z_type qd= pd*tan(pd);
z_type r = cos(pd);
printf("%19.14lf %19.14lf\n",Re(pd),Im(pd));
printf("%19.14lf %19.14lf\n",Re(qd),Im(qd));
printf("%19.14lf %19.14lf\n",Re(r),Im(r));
FILE *o;o=fopen("modeabso25.eps","w");ado(o,652,224);
fprintf(o,"210 114 translate\n 100 100 scale\n");
for(m=-2;m<5;m++){M(m,-1)L(m,1)}
for(n=-1;n<2;n++){M(-2,n)L(4.4,n)}
fprintf(o,"2 setlinecap .003 W 0 0 0 RGB S\n");
DO(m,630){x=-2.01+.01*m; z=pd*x; y=Re(cos(z)); if(m==0)M(x,y)else L(x,y) }
fprintf(o,"1 setlinejoin 1 setlinecap .01 W 0 0 .8 RGB S\n");
DO(m,642){x=-2.01+.01*m; z=pd*x; y=Im(cos(z)); if(m==0)M(x,y)else L(x,y) }
fprintf(o,"1 setlinejoin 1 setlinecap .01 W .8 0 0 RGB S\n");
DO(m,190){x=-.13-.01*m; z=qd*(fabs(x)-1.); z_type t;t=r*exp(-z);y=Re(t); if(m==0)M(x,y)else L(x,y)}
DO(m,390){x= .13+.01*m; z=qd*(fabs(x)-1.); z_type t;t=r*exp(-z);y=Re(t); if(m==0)M(x,y)else L(x,y)}

// y=Re(r*exp(-z)); // for some reasons the C++ dislikes this

fprintf(o,"1 setlinejoin 1 setlinecap .01 W 0 .7 0 RGB S\n");
DO(m,190){x=-.46-.01*m; z=qd*(fabs(x)-1.); z_type t;t=r*exp(-z);y=Im(t); if(m==0)M(x,y)else L(x,y)}
DO(m,390){x= .46+.01*m; z=qd*(fabs(x)-1.); z_type t;t=r*exp(-z);y=Im(t); if(m==0)M(x,y)else L(x,y)}
fprintf(o,"1 setlinejoin 1 setlinecap .01 W .7 0 .7 RGB S\n");
fprintf(o,"showpage\n%c%cTrailer",'%','%'); fclose(o);
     system("epstopdf modeabso25.eps");
     system(    "open modeabso25.pdf");
     getchar(); system("killall Preview");//for mac
}

Latex generator of labels

% File modeabso25.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 1612pt %<br> \paperwidth 1280pt %<br> \paperheight 436pt %<br> \topmargin -90pt %<br> \oddsidemargin -106pt %<br> \textwidth 900pt %<br> \textheight 900pt %<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> \parindent 0pt %\sx{2}{ \begin{picture}(840,214) %<br> \sx{2}{ \begin{picture}(600,214) %<br> \put(4,6){\ing{modeabso25}} %<br> \put(215,211){\sx{1.6}{$y$}} %<br> \put(215,114){\sx{1.6}{\bf 0}} %<br> \put(206, 15){\sx{1.6}{\bf -1}} %<br> \put(103,104){\sx{1.6}{\bf -1}} %<br> \put(310,104){\sx{1.6}{\bf 1}} %<br> \put(410,104){\sx{1.6}{\bf 2}} %<br> \put(510,104){\sx{1.6}{\bf 3}} %<br> \put(610,104){\sx{1.6}{\bf 4}} %<br> \put(629,104){\sx{1.6}{$x\!/\!d$}} %<br> %\put(790,105){\sx{1.7}{$x$}} %<br> \put(281,198){\sx{1.3}{\rot{0}$y\!=\!\Re\!\Big(r \exp\!\big(q(|x|\!-\!d)\big)\Big)$\ero}} %<br> \put(400,148){\sx{1.3}{\rot{0}$y\!=\!\Im\!\Big(\!\cos(px)\Big)$\ero}} %<br> \put(400, 42){\sx{1.3}{\rot{0}$y\!=\!\Re\!\Big(\!\cos(px)\Big)$\ero}} %<br> \put(242, 24){\sx{1.3}{\rot{0}$y\!=\!\Im\!\Big(r \exp\!\big(q(|x|\!-\!d)\big)\Big)$\ero}} %<br> %\put(618, 65){\sx{2.52}{\rot{4}$y\!=\!\Im(\mathrm{acosq}(x))$\ero}} %<br> \end{picture} %<br> } %<br> \end{document} %

% Copyleft 2012 by Dmitrii Kouznetov

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 20132,657 × 905 (262 KB)Maintenance script (talk | contribs)Importing image file

The following page uses this file:

Metadata