Difference between revisions of "File:Besselk0mapT900.png"

From TORI
Jump to navigation Jump to search
(Importing image file)
 
 
Line 1: Line 1:
  +
[[Complex map]] of function [[BesselK0]].
Importing image file
 
  +
  +
$u+\mathrm i v= \mathrm{BesselK0}(x+\mathrm i y)$
  +
  +
==C++ implementation of BesselK0==
  +
// Preliminary version of the [[C++]] implementation of BesselK0 below should be saved as [[besselk09.cin]].
  +
  +
// Besselk09 returns 9 correct decimal digits.
  +
//#include "besselk0o.cin"
  +
z_type besselk0o(z_type z){ z_type L=log(z); z_type t=z*z;
  +
return 0.115931515658412449 - L
  +
+t*(0.278982878914603112 - 0.25 * L
  +
+t*(0.0252489299321626945 - 0.015625 * L
  +
+t*(0.000846035090708222996 - 0.000434027777777777778*L
  +
+t*(0.0000149147192992604288- 6.78168402777777778e-6 *L
  +
+t*(1.62710561048159843e-7 - 6.78168402777777778e-8 *L
  +
+t*(1.20842616500779726e-9 - 4.70950279706790123e-10*L
  +
+t*(6.50869783874735494e-12 - 2.40280754952443941e-12*L
  +
+t*(2.65978468063980854e-14 - 9.38596699032984143e-15*L
  +
+t*(8.53109013195859431e-17 - 2.89690339207711155e-17*L
  +
+t*(2.205195117791576e-19 - 7.242258480192779e-20*L
  +
+t*(4.692218659603046e-22 - 1.4963343967340453e-22*L
  +
+t*(8.362696515042043e-25 - 2.5978027721077174e-25*L
  +
+t*(1.2666460795135898e-27 - 3.8429035090350849e-28*L
  +
+t*(1.6506318753729743e-30 - 4.9016626390753634e-31*L
  +
+t*(1.8703440292223815e-33 - 5.446291821194848e-34*L
  +
+t*(1.8597493682664544e-36 - 5.318644356635594e-37*L
  +
+t*(1.6358438681148629e-39 - 4.6009034226951505e-40*L
  +
+t*(1.2819478724424317e-42 - 3.5500798014623075e-43*L
  +
+t*(9.007150297620802e-46 - 2.4585040176331769e-46*L
  +
+t*(5.706297186564038e-49 - 1.5365650110207356e-49*L
  +
+t*(3.2763418078194994e-52 - 8.710686003518909e-53*L
  +
+t*(1.7127767743327592e-55 - 4.4993212828093539e-56*L
  +
+t*(8.186857470603763e-59 - 2.1263333094562164e-59*L
  +
+t*(3.5917772099961397e-62 - 9.228877211181495e-63*L
  +
+t*(1.4514770875363463e-65 - 3.6915508844725979e-66*L
  +
+t*(5.420397042044871e-69 - 1.3652185223641265e-69*L
  +
)))) )))) )))) )))) )))) )))) ) ; }
  +
  +
z_type besselk0O(z_type z){ z_type t=1./z, q=sqrt(t); z_type s;
  +
s=1.25331413731550025 +
  +
t*(-0.156664267164437531 +
  +
t*( 0.0881236502799961114+
  +
t*(-0.0917954690416626161+
  +
t*( 0.140561811970045881 +
  +
t*(-0.284637669239342909 +
  +
t*( 0.717524124540843582 +
  +
t*(-2.16538530441790295 +
  +
t*( 7.61268271084419007 +
  +
t*(-30.5564625476940407 +
  +
t*( 137.886037246469359 +
  +
t*(-690.997073019238491 +
  +
t*( 3807.68178778309543 +
  +
t*(-22882.7030515811024 +
  +
t*(148941.879683951997 +
  +
t*(-1.0438343401183636e6
  +
)))) )))) )))) ))) ; return exp(-z)*q*s;}
  +
  +
z_type besselk09(z_type z){
  +
DB x=Re(z)+3.8, y=Im(z); if( x*x+y*y < 13*13 )
  +
return besselk0o(z);
  +
return besselk0O(z); }
  +
  +
==C++ generator of curves==
  +
// File [[besselk09.cin]] above and [[conto.cin]] and [[ado.cin]] should be stored in the working directory in order to compile 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 "conto.cin"
  +
#include "besselk09.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("besselk0map.eps","w");ado(o,162,162);
  +
fprintf(o,"81 81 translate\n 10 10 scale\n");
  +
DO(n,200)Y[n]=-8.+.04*n;
  +
Y[200]=-.006;
  +
Y[201]= .006;
  +
for(n=202;n<N1;n++) Y[n]=-8.+.04*(n-1);
  +
DO(m,M1)X[m]=Y[m];
  +
// DO(m,M1)X[m]=-4.+.04*(m-.5);
  +
for(m=-8;m<9;m++){if(m==0){M(m,-8.1)L(m,8.1)} else{M(m,-8)L(m,8)}}
  +
for(n=-8;n<9;n++){ M( -8,n)L(8,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= besselk09(z);
  +
// c= besselk0O(z);
  +
// d= besselk0o(z);
  +
// p=abs((c-d)/(c+d)); p=-log(p)/log(10.);
  +
p=Re(c); q=Im(c);
  +
if(p>-43. && p<43.
  +
&& q>-43. && q<43.
  +
)
  +
{g[m*N1+n]=p;
  +
f[m*N1+n]=q;
  +
}
  +
}}
  +
//fprintf(o,"-3.8 0 13 0 360 arc C 1 .8 1 RGB .5 W S\n");
  +
// #include "plodi.cin"
  +
// #include "plofu.cin"
  +
fprintf(o,"1 setlinejoin 1 setlinecap\n"); p=1.5;q=1.2;
  +
for(m=-4;m<4;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<4;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<4;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<9;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<9;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");
  +
M(0,0)L(-8,0) fprintf(o,"0 setlinecap 1 1 1 RGB .02 W S\n");
  +
DO(m,32){ M(-.25*(m+.25),0)L(-.25*(m+.75),0) fprintf(o,"0 0 0 RGB .035 W S\n"); }
  +
fprintf(o,"showpage\n%c%cTrailer",'%','%'); fclose(o);
  +
system("epstopdf besselk0map.eps");
  +
system( "open besselk0map.pdf");
  +
getchar(); system("killall Preview");//for mac
  +
}
  +
  +
==Latex generator of labels==
  +
% File [[besselk0map.pdf]] should be generated with the [[C++]] code above in order to compile the [[Latex]] document below:
  +
  +
<nowiki>
  +
\documentclass[12pt]{article} % <br>
  +
\usepackage{geometry} % <br>
  +
\usepackage{graphicx} % <br>
  +
\usepackage{rotating} % <br>
  +
\usepackage{hyperref} % <br>
  +
\paperwidth 170pt % <br>
  +
\paperheight 169pt % <br>
  +
\textwidth 180pt % <br>
  +
\textheight 180pt % <br>
  +
\topmargin -108pt % <br>
  +
\oddsidemargin -72pt % <br>
  +
\parindent 0pt % <br>
  +
\begin {document} % <br>
  +
\newcommand \sx {\scalebox} % <br>
  +
\newcommand \rme {{e}} % <br>
  +
\newcommand \rmi {{\rm i}} %imaginary unity is always roman font % <br>
  +
\newcommand \ds {\displaystyle} % <br>
  +
\newcommand \bN {\mathbb{N}} % <br>
  +
\newcommand \bC {\mathbb{C}} % <br>
  +
\newcommand \bR {\mathbb{R}} % <br>
  +
\newcommand \cO {\mathcal{O}} % <br>
  +
\newcommand \cF {\mathcal{F}} % <br>
  +
\newcommand \rot {\begin{rotate}} % <br>
  +
\newcommand \ero {\end{rotate}} % <br>
  +
\newcommand \nS {\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!} % <br>
  +
\newcommand \pS {{~}~{~}} % <br>
  +
\newcommand \fac {\mathrm{Factorial}} % <br>
  +
\begin{picture}(166,166) %<br>
  +
\put(8,5){\includegraphics{besselk0map.pdf}} % %<br>
  +
\put( 3,163){\sx{.8}{$y$}} %<br>
  +
\put( 3,143){\sx{.8}{$6$}} %<br>
  +
\put( 3,123){\sx{.8}{$4$}} %<br>
  +
\put( 3,103){\sx{.8}{$2$}} %<br>
  +
\put( 3,83){\sx{.8}{$0$}} %<br>
  +
\put(-3,63){\sx{.8}{$-2$}} %<br>
  +
\put(-3,43){\sx{.8}{$-4$}} %<br>
  +
\put(-3,23){\sx{.8}{$-6$}} %<br>
  +
\put(23,-1){\sx{.75}{$-6$}} %<br>
  +
\put(43,-1){\sx{.75}{$-4$}} %<br>
  +
\put(63,-1){\sx{.75}{$-2$}} %<br>
  +
\put(87.4,-1){\sx{.75}{$0$}} %<br>
  +
\put(107.4,-1){\sx{.75}{$2$}} %<br>
  +
\put(127.4,-1){\sx{.75}{$4$}} %<br>
  +
\put(147.4,-1){\sx{.75}{$6$}} %<br>
  +
\put(164.6,-.5){\sx{.8}{$x$}} %<br>
  +
\put(12,83.5){\bf cut} %<br>
  +
\put(142,157.8){$u\!=\!0$} %<br>
  +
\put(142,143.0){$v\!=\!0$} %<br>
  +
\put(142,127.7){$u\!=\!0$} %<br>
  +
\put(142,113.0){$v\!=\!0$} %<br>
  +
\put(142,98.0){$u\!=\!0$} %<br>
  +
\put(142,83.5){$v\!=\!0$} %central %<br>
  +
\put(142,68.0){$u\!=\!0$} %<br>
  +
\put(142,54.0){$v\!=\!0$} %<br>
  +
\put(142,39.0){$u\!=\!0$} %<br>
  +
\put(142,24.0){$v\!=\!0$} %<br>
  +
\put(142,9.0){$u\!=\!0$} %<br>
  +
% %<br>
  +
\put(102.6,93){\sx{.6}{$v\!=\!-0.2$}} %<br>
  +
\put(104,87){\sx{.6}{$u\!=\!0.2$}} %<br>
  +
\put(103,77){\sx{.6}{$v\!=\!0.2$}} %<br>
  +
\put(101.6,61){\sx{.6}{$u\!=\!-0.2$}} %<br>
  +
\put(99.4,48){\sx{.6}{$v\!=\!-0.2$}} %<br>
  +
\end{picture} % %<br>
  +
\end{document} %
  +
</nowiki>
  +
  +
[[Category:Complex map]]
  +
[[Category:Besselk0]]
  +
[[Category:Bessel function]]
  +
[[Category:Cylindric function]]

Latest revision as of 09:41, 21 June 2013

Complex map of function BesselK0.

$u+\mathrm i v= \mathrm{BesselK0}(x+\mathrm i y)$

C++ implementation of BesselK0

// Preliminary version of the C++ implementation of BesselK0 below should be saved as besselk09.cin.

// Besselk09 returns 9 correct decimal digits.
//#include "besselk0o.cin"
z_type besselk0o(z_type z){ z_type L=log(z); z_type t=z*z;
return 0.115931515658412449 - L
+t*(0.278982878914603112    -  0.25    * L 
+t*(0.0252489299321626945   - 0.015625 * L  
+t*(0.000846035090708222996 - 0.000434027777777777778*L 
+t*(0.0000149147192992604288- 6.78168402777777778e-6 *L
+t*(1.62710561048159843e-7 -  6.78168402777777778e-8 *L
+t*(1.20842616500779726e-9 -  4.70950279706790123e-10*L
+t*(6.50869783874735494e-12 - 2.40280754952443941e-12*L
+t*(2.65978468063980854e-14 - 9.38596699032984143e-15*L
+t*(8.53109013195859431e-17 - 2.89690339207711155e-17*L
+t*(2.205195117791576e-19 - 7.242258480192779e-20*L
+t*(4.692218659603046e-22 - 1.4963343967340453e-22*L
+t*(8.362696515042043e-25 - 2.5978027721077174e-25*L
+t*(1.2666460795135898e-27 - 3.8429035090350849e-28*L
+t*(1.6506318753729743e-30 - 4.9016626390753634e-31*L
+t*(1.8703440292223815e-33 - 5.446291821194848e-34*L
+t*(1.8597493682664544e-36 - 5.318644356635594e-37*L
+t*(1.6358438681148629e-39 - 4.6009034226951505e-40*L
+t*(1.2819478724424317e-42 - 3.5500798014623075e-43*L
+t*(9.007150297620802e-46 - 2.4585040176331769e-46*L
+t*(5.706297186564038e-49 - 1.5365650110207356e-49*L
+t*(3.2763418078194994e-52 - 8.710686003518909e-53*L
+t*(1.7127767743327592e-55 - 4.4993212828093539e-56*L
+t*(8.186857470603763e-59 - 2.1263333094562164e-59*L
+t*(3.5917772099961397e-62 - 9.228877211181495e-63*L
+t*(1.4514770875363463e-65 - 3.6915508844725979e-66*L
+t*(5.420397042044871e-69 - 1.3652185223641265e-69*L
)))) )))) ))))  )))) )))) )))) )  ; }
z_type besselk0O(z_type z){ z_type t=1./z, q=sqrt(t); z_type s;
s=1.25331413731550025  +
t*(-0.156664267164437531 +
t*( 0.0881236502799961114+
t*(-0.0917954690416626161+
t*( 0.140561811970045881 +
t*(-0.284637669239342909 + 
t*( 0.717524124540843582 +
t*(-2.16538530441790295  + 
t*( 7.61268271084419007  + 
t*(-30.5564625476940407  +
t*( 137.886037246469359  +
t*(-690.997073019238491  +
t*( 3807.68178778309543  +
t*(-22882.7030515811024  +
t*(148941.879683951997   +
t*(-1.0438343401183636e6 
)))) )))) )))) ))) ; return exp(-z)*q*s;}
z_type besselk09(z_type z){ 
DB x=Re(z)+3.8, y=Im(z); if( x*x+y*y < 13*13 ) 
                      return besselk0o(z);
                      return besselk0O(z); }

C++ generator of curves

// File besselk09.cin above and conto.cin and ado.cin should be stored in the working directory in order to compile 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 "conto.cin"
#include "besselk09.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("besselk0map.eps","w");ado(o,162,162);
fprintf(o,"81 81 translate\n 10 10 scale\n");
DO(n,200)Y[n]=-8.+.04*n;
      Y[200]=-.006;
      Y[201]= .006;
for(n=202;n<N1;n++) Y[n]=-8.+.04*(n-1);
DO(m,M1)X[m]=Y[m];
// DO(m,M1)X[m]=-4.+.04*(m-.5);
for(m=-8;m<9;m++){if(m==0){M(m,-8.1)L(m,8.1)} else{M(m,-8)L(m,8)}}
for(n=-8;n<9;n++){     M(  -8,n)L(8,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= besselk09(z);
//     c= besselk0O(z);
//     d= besselk0o(z);
//       p=abs((c-d)/(c+d));  p=-log(p)/log(10.);
     p=Re(c);  q=Im(c);        
      if(p>-43. && p<43.
   &&     q>-43. && q<43. 
      )
      {g[m*N1+n]=p; 
   f[m*N1+n]=q;
       }
                      }}
//fprintf(o,"-3.8 0 13 0 360 arc C 1 .8 1 RGB .5 W S\n");
// #include "plodi.cin"
// #include "plofu.cin"
 fprintf(o,"1 setlinejoin 1 setlinecap\n"); p=1.5;q=1.2;
for(m=-4;m<4;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<4;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<4;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<9;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<9;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");
M(0,0)L(-8,0) fprintf(o,"0 setlinecap 1 1 1 RGB .02 W S\n"); 
DO(m,32){ M(-.25*(m+.25),0)L(-.25*(m+.75),0) fprintf(o,"0 0 0 RGB .035 W S\n"); }
fprintf(o,"showpage\n%c%cTrailer",'%','%'); fclose(o);
      system("epstopdf besselk0map.eps");
      system(    "open besselk0map.pdf");            
      getchar(); system("killall Preview");//for mac
}

Latex generator of labels

% File besselk0map.pdf should be generated with the C++ code above in order to compile the Latex document below:

\documentclass[12pt]{article} % <br> \usepackage{geometry} % <br> \usepackage{graphicx} % <br> \usepackage{rotating} % <br> \usepackage{hyperref} % <br> \paperwidth 170pt % <br> \paperheight 169pt % <br> \textwidth 180pt % <br> \textheight 180pt % <br> \topmargin -108pt % <br> \oddsidemargin -72pt % <br> \parindent 0pt % <br> \begin {document} % <br> \newcommand \sx {\scalebox} % <br> \newcommand \rme {{e}} % <br> \newcommand \rmi {{\rm i}} %imaginary unity is always roman font % <br> \newcommand \ds {\displaystyle} % <br> \newcommand \bN {\mathbb{N}} % <br> \newcommand \bC {\mathbb{C}} % <br> \newcommand \bR {\mathbb{R}} % <br> \newcommand \cO {\mathcal{O}} % <br> \newcommand \cF {\mathcal{F}} % <br> \newcommand \rot {\begin{rotate}} % <br> \newcommand \ero {\end{rotate}} % <br> \newcommand \nS {\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!} % <br> \newcommand \pS {{~}~{~}} % <br> \newcommand \fac {\mathrm{Factorial}} % <br> \begin{picture}(166,166) %<br> \put(8,5){\includegraphics{besselk0map.pdf}} % %<br> \put( 3,163){\sx{.8}{$y$}} %<br> \put( 3,143){\sx{.8}{$6$}} %<br> \put( 3,123){\sx{.8}{$4$}} %<br> \put( 3,103){\sx{.8}{$2$}} %<br> \put( 3,83){\sx{.8}{$0$}} %<br> \put(-3,63){\sx{.8}{$-2$}} %<br> \put(-3,43){\sx{.8}{$-4$}} %<br> \put(-3,23){\sx{.8}{$-6$}} %<br> \put(23,-1){\sx{.75}{$-6$}} %<br> \put(43,-1){\sx{.75}{$-4$}} %<br> \put(63,-1){\sx{.75}{$-2$}} %<br> \put(87.4,-1){\sx{.75}{$0$}} %<br> \put(107.4,-1){\sx{.75}{$2$}} %<br> \put(127.4,-1){\sx{.75}{$4$}} %<br> \put(147.4,-1){\sx{.75}{$6$}} %<br> \put(164.6,-.5){\sx{.8}{$x$}} %<br> \put(12,83.5){\bf cut} %<br> \put(142,157.8){$u\!=\!0$} %<br> \put(142,143.0){$v\!=\!0$} %<br> \put(142,127.7){$u\!=\!0$} %<br> \put(142,113.0){$v\!=\!0$} %<br> \put(142,98.0){$u\!=\!0$} %<br> \put(142,83.5){$v\!=\!0$} %central %<br> \put(142,68.0){$u\!=\!0$} %<br> \put(142,54.0){$v\!=\!0$} %<br> \put(142,39.0){$u\!=\!0$} %<br> \put(142,24.0){$v\!=\!0$} %<br> \put(142,9.0){$u\!=\!0$} %<br> % %<br> \put(102.6,93){\sx{.6}{$v\!=\!-0.2$}} %<br> \put(104,87){\sx{.6}{$u\!=\!0.2$}} %<br> \put(103,77){\sx{.6}{$v\!=\!0.2$}} %<br> \put(101.6,61){\sx{.6}{$u\!=\!-0.2$}} %<br> \put(99.4,48){\sx{.6}{$v\!=\!-0.2$}} %<br> \end{picture} % %<br> \end{document} %

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,118 × 2,105 (1.62 MB)Maintenance script (talk | contribs)Importing image file

The following page uses this file:

Metadata