Difference between revisions of "File:Besselj0map1T080.png"
(Importing image file) |
|||
| Line 1: | Line 1: | ||
| + | [[Complex map]] of the Bessel function [[BesselJ0]] |
||
| − | Importing image file |
||
| + | |||
| + | $f=\mathrm{BesselJ}_0(x+\mathrm i y)$ is shown in the $x$,$y$ plane with |
||
| + | lines $u\!=\!\Re(f)\!=\!\mathrm{const}$ and |
||
| + | lines $v\!=\!\Im(f)\!=\!\mathrm{const}$. |
||
| + | |||
| + | ==C++ implementation of [[BesselJ0]]== |
||
| + | // The file below should be stored in the working directory as [[besselj0.cin]] |
||
| + | |||
| + | z_type BesselJ0o(z_type z){ int n; z_type c,s,t; |
||
| + | s=1.; c=1.; t=-z*z/4.; for(n=1;n<32;n++) {c/=0.+n*n; c*=t; s+=c;} |
||
| + | return s;} |
||
| + | |||
| + | z_type BesselJ0B(z_type z){ int n; z_type c,C,s,S,t,u,x; |
||
| + | t=M_PI/4.-z; c=cos(t); s=sin(t); u=1./16./(z*z); |
||
| + | C=((((((((((( |
||
| + | + 11021897833929133607268351617203125./137438953472.)*u |
||
| + | - 502860269940467106811189921875./8589934592.)*u |
||
| + | + 57673297952355815927071875./1073741824.)*u |
||
| + | - 1070401384414690453125./16777216.)*u |
||
| + | + 213786613951685775./2097152.)*u |
||
| + | - 30241281245175./131072.)*u |
||
| + | + 13043905875./16384.)*u |
||
| + | - 2401245./512.)*u |
||
| + | + 3675./64.)* u |
||
| + | - 9./4.)*u + 2.)* c; |
||
| + | S=((((((((((( |
||
| + | - 882276678992136837800861860405640625./274877906944.)*u |
||
| + | + 36232405765710498380237842265625./17179869184.)*u |
||
| + | - 3694483615889146090857721875./2147483648.)*u |
||
| + | + 60013837619516978071875./33554432.)*u |
||
| + | - 10278202593831046875./4194304.)*u |
||
| + | + 1212400457192925./262144.)*u |
||
| + | - 418854310875./32768.)*u |
||
| + | + 57972915./1024.)*u |
||
| + | - 59535./128.)*u |
||
| + | + 75./8.)*u - 1.) *s/4./z; |
||
| + | return (C+S)/sqrt(2.*M_PI*z);} |
||
| + | |||
| + | z_type BesselJ0(z_type z){ if(Re(z)<0.) z=-z; |
||
| + | DB x=(Re(z)-2.)/12.; DB y=Im(z)/19.; |
||
| + | if(x*x+y*y<1.) return BesselJ0o(z); |
||
| + | return BesselJ0B(z); } |
||
| + | |||
| + | // The function BesselJ0 returns of order of a dozen of correct decimal digits. |
||
| + | |||
| + | ==C++ generator of curves== |
||
| + | |||
| + | // Fies [[besselj0.cin]] above and [[ado.cin]] and [[conto.cin]] should be stored in the working directory in order to compile the code below. |
||
| + | |||
| + | #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 "besselj0.cin" |
||
| + | main(){ int j,k,m,n; DB x,y, p,q, t; z_type z,c,d; |
||
| + | int M=801,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("besselj0map1.eps","w");ado(o,162,82); |
||
| + | fprintf(o,"81 41 translate\n 10 10 scale\n"); |
||
| + | DO(m,400) X[m]=-8.+.02*m; |
||
| + | X[400]=-.001; |
||
| + | X[401]= .001; |
||
| + | for(m=402;m<M1;m++) X[m]=-8.+.02*(m-1.); |
||
| + | DO(n,200)Y[n]=-4.+.02*n; |
||
| + | Y[200]=-.001; |
||
| + | Y[201]= .001; |
||
| + | for(n=202;n<N1;n++) Y[n]=-4.+.02*(n-1.); |
||
| + | //DO(m,M1)X[m]=Y[m]; |
||
| + | for(m=-8;m<9;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( -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=BesselJ0(z); |
||
| + | 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" |
||
| + | fprintf(o,"1 setlinejoin 1 setlinecap\n"); p=1.5;q=.5; |
||
| + | for(m=-12;m<12;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<12;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<12;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<12;m++) conto(o,f,w,v,X,Y,M,N, (0.-m),-p,p); fprintf(o,".02 W .9 0 0 RGB S\n"); |
||
| + | for(m=1;m<12;m++) conto(o,f,w,v,X,Y,M,N, (0.+m),-p,p); fprintf(o,".02 W 0 0 .9 RGB S\n"); |
||
| + | conto(o,f,w,v,X,Y,M,N, (0. ),-2*p,2*p); fprintf(o,".02 W .6 0 .6 RGB S\n"); |
||
| + | for(m=-11;m<0;m++) conto(o,g,w,v,X,Y,M,N, (0.+m),-p,p); fprintf(o,".02 W 0 0 0 RGB S\n"); |
||
| + | m=0; conto(o,g,w,v,X,Y,M,N, (0.+m),-2*p,2*p); fprintf(o,".02 W 0 0 0 RGB S\n"); |
||
| + | for(m=1;m<12;m++) conto(o,g,w,v,X,Y,M,N, (0.+m),-p,p); fprintf(o,".02 W 0 0 0 RGB S\n"); |
||
| + | //#include "plofu.cin" |
||
| + | fprintf(o,"showpage\n%c%cTrailer",'%','%'); fclose(o); |
||
| + | system("epstopdf besselj0map1.eps"); |
||
| + | system( "open besselj0map1.pdf"); |
||
| + | getchar(); system("killall Preview");//for mac |
||
| + | } |
||
| + | |||
| + | ==Latex generator of labels== |
||
| + | |||
| + | % File [[acoscmap.pdf]] should be generated with the code above in order to compile the [[latex]] document below: |
||
| + | %<nowiki><br> |
||
| + | |||
| + | \documentclass[12pt]{article} %<br> |
||
| + | \paperheight 838px %<br> |
||
| + | \paperwidth 1644px %<br> |
||
| + | \textwidth 1294px %<br> |
||
| + | \textheight 1200px %<br> |
||
| + | \topmargin -80px %<br> |
||
| + | \oddsidemargin -80px %<br> |
||
| + | \usepackage{graphics} %<br> |
||
| + | \usepackage{rotating} %<br> |
||
| + | \usepackage{color}%<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}{$-\!6$}} %<br> |
||
| + | \put(420, 5){\sx{4}{$-\!4$}} %<br> |
||
| + | \put(620, 5){\sx{4}{$-\!2$}} %<br> |
||
| + | \put(843, 5){\sx{4}{$0$}} %<br> |
||
| + | \put(1043, 5){\sx{4}{$2$}} %<br> |
||
| + | \put(1243, 5){\sx{4}{$4$}} %<br> |
||
| + | \put(1443, 5){\sx{4}{$6$}} %<br> |
||
| + | \put(1631,6){\sx{4}{$x$}} %<br> |
||
| + | } %<br> |
||
| + | \parindent 0pt %<br> |
||
| + | \begin{picture}(1616,816) %<br> |
||
| + | \put(40,30){\sx{10}{\ing{besselj0map1}}} %<br> |
||
| + | \zoomax %<br> |
||
| + | \put(170,430){\sx{4}{\rot{0}$v\!=\!0$\ero}} %<br> |
||
| + | \put(800,613){\sx{4}{$u\!=\!2$}} %<br> |
||
| + | \put(865,500){\sx{4}{\rot{90}$v\!=\!0$\ero}} %<br> |
||
| + | \put(872,446){\sx{4}{\rot{46}$u\!=\!1$\ero}} %<br> |
||
| + | \put(862,420){\sx{4}{\rot{-46}$u\!=\!1$\ero}} %<br> |
||
| + | \put(630,468){\sx{4}{\rot{0}$v\!=\!0.2$\ero}} %<br> |
||
| + | \put(630,430){\sx{4}{\rot{0}$v\!=\!0$\ero}} |
||
| + | \put(900,430){\sx{4}{\rot{0}$v\!=\!0$\ero}} %<br> |
||
| + | \put(628,392){\sx{4}{\rot{0}$v\!=\!-0.2$\ero}} %<br> |
||
| + | \put(624,390){\sx{4}{\rot{90}$u\!=\!0$\ero}} %<br> |
||
| + | \put(160,390){\sx{4}{\rot{90}$v\!=\!0$\ero}} %<br> |
||
| + | \put(312,396){\sx{4}{\rot{90}$u\!=\!0$\ero}} %<br> |
||
| + | \put(362,366){\sx{3.8}{\rot{90}$u\!=\!-0.2$\ero}} %<br> |
||
| + | \put(428,370){\sx{3.8}{\rot{90}$u\!=\!-0.4$\ero}} %<br> |
||
| + | \put(482,396){\sx{4}{\rot{90}$v\!=\!0$\ero}} %<br> |
||
| + | \put(1106,390){\sx{4}{\rot{90}$u\!=\!0$\ero}} %<br> |
||
| + | \put(1250,390){\sx{4}{\rot{90}$v\!=\!0$\ero}} %<br> |
||
| + | \put(1419,390){\sx{4}{\rot{90}$u\!=\!0$\ero}} %<br> |
||
| + | \put(1568,390){\sx{4}{\rot{90}$v\!=\!0$\ero}} %<br> |
||
| + | \end{picture} %<br> |
||
| + | \end{document} %<br> |
||
| + | %</nowiki> |
||
| + | |||
| + | ==References== |
||
| + | |||
| + | http://reference.wolfram.com/mathematica/ref/BesselJ.ja.html |
||
| + | |||
| + | [[Category:BesselJ0]] |
||
| + | [[Category:Complex map]] |
||
| + | [[Category:Bessel function]] |
||
| + | [[Category:Cylindric function]] |
||
| + | [[Category:C++]] |
||
| + | [[Category:Latex]] |
||
Latest revision as of 09:41, 21 June 2013
Complex map of the Bessel function BesselJ0
$f=\mathrm{BesselJ}_0(x+\mathrm i y)$ is shown in the $x$,$y$ plane with lines $u\!=\!\Re(f)\!=\!\mathrm{const}$ and lines $v\!=\!\Im(f)\!=\!\mathrm{const}$.
C++ implementation of BesselJ0
// The file below should be stored in the working directory as besselj0.cin
z_type BesselJ0o(z_type z){ int n; z_type c,s,t;
s=1.; c=1.; t=-z*z/4.; for(n=1;n<32;n++) {c/=0.+n*n; c*=t; s+=c;}
return s;}
z_type BesselJ0B(z_type z){ int n; z_type c,C,s,S,t,u,x;
t=M_PI/4.-z; c=cos(t); s=sin(t); u=1./16./(z*z);
C=(((((((((((
+ 11021897833929133607268351617203125./137438953472.)*u
- 502860269940467106811189921875./8589934592.)*u
+ 57673297952355815927071875./1073741824.)*u
- 1070401384414690453125./16777216.)*u
+ 213786613951685775./2097152.)*u
- 30241281245175./131072.)*u
+ 13043905875./16384.)*u
- 2401245./512.)*u
+ 3675./64.)* u
- 9./4.)*u + 2.)* c;
S=(((((((((((
- 882276678992136837800861860405640625./274877906944.)*u
+ 36232405765710498380237842265625./17179869184.)*u
- 3694483615889146090857721875./2147483648.)*u
+ 60013837619516978071875./33554432.)*u
- 10278202593831046875./4194304.)*u
+ 1212400457192925./262144.)*u
- 418854310875./32768.)*u
+ 57972915./1024.)*u
- 59535./128.)*u
+ 75./8.)*u - 1.) *s/4./z;
return (C+S)/sqrt(2.*M_PI*z);}
z_type BesselJ0(z_type z){ if(Re(z)<0.) z=-z;
DB x=(Re(z)-2.)/12.; DB y=Im(z)/19.;
if(x*x+y*y<1.) return BesselJ0o(z);
return BesselJ0B(z); }
// The function BesselJ0 returns of order of a dozen of correct decimal digits.
C++ generator of curves
// Fies besselj0.cin above and ado.cin and conto.cin should be stored in the working directory in order to compile the code below.
#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 "besselj0.cin"
main(){ int j,k,m,n; DB x,y, p,q, t; z_type z,c,d;
int M=801,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("besselj0map1.eps","w");ado(o,162,82);
fprintf(o,"81 41 translate\n 10 10 scale\n");
DO(m,400) X[m]=-8.+.02*m;
X[400]=-.001;
X[401]= .001;
for(m=402;m<M1;m++) X[m]=-8.+.02*(m-1.);
DO(n,200)Y[n]=-4.+.02*n;
Y[200]=-.001;
Y[201]= .001;
for(n=202;n<N1;n++) Y[n]=-4.+.02*(n-1.);
//DO(m,M1)X[m]=Y[m];
for(m=-8;m<9;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( -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=BesselJ0(z);
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"
fprintf(o,"1 setlinejoin 1 setlinecap\n"); p=1.5;q=.5;
for(m=-12;m<12;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<12;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<12;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<12;m++) conto(o,f,w,v,X,Y,M,N, (0.-m),-p,p); fprintf(o,".02 W .9 0 0 RGB S\n");
for(m=1;m<12;m++) conto(o,f,w,v,X,Y,M,N, (0.+m),-p,p); fprintf(o,".02 W 0 0 .9 RGB S\n");
conto(o,f,w,v,X,Y,M,N, (0. ),-2*p,2*p); fprintf(o,".02 W .6 0 .6 RGB S\n");
for(m=-11;m<0;m++) conto(o,g,w,v,X,Y,M,N, (0.+m),-p,p); fprintf(o,".02 W 0 0 0 RGB S\n");
m=0; conto(o,g,w,v,X,Y,M,N, (0.+m),-2*p,2*p); fprintf(o,".02 W 0 0 0 RGB S\n");
for(m=1;m<12;m++) conto(o,g,w,v,X,Y,M,N, (0.+m),-p,p); fprintf(o,".02 W 0 0 0 RGB S\n");
//#include "plofu.cin"
fprintf(o,"showpage\n%c%cTrailer",'%','%'); fclose(o);
system("epstopdf besselj0map1.eps");
system( "open besselj0map1.pdf");
getchar(); system("killall Preview");//for mac
}
Latex generator of labels
% File acoscmap.pdf should be generated with the code above in order to compile the latex document below: %<br> \documentclass[12pt]{article} %<br> \paperheight 838px %<br> \paperwidth 1644px %<br> \textwidth 1294px %<br> \textheight 1200px %<br> \topmargin -80px %<br> \oddsidemargin -80px %<br> \usepackage{graphics} %<br> \usepackage{rotating} %<br> \usepackage{color}%<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}{$-\!6$}} %<br> \put(420, 5){\sx{4}{$-\!4$}} %<br> \put(620, 5){\sx{4}{$-\!2$}} %<br> \put(843, 5){\sx{4}{$0$}} %<br> \put(1043, 5){\sx{4}{$2$}} %<br> \put(1243, 5){\sx{4}{$4$}} %<br> \put(1443, 5){\sx{4}{$6$}} %<br> \put(1631,6){\sx{4}{$x$}} %<br> } %<br> \parindent 0pt %<br> \begin{picture}(1616,816) %<br> \put(40,30){\sx{10}{\ing{besselj0map1}}} %<br> \zoomax %<br> \put(170,430){\sx{4}{\rot{0}$v\!=\!0$\ero}} %<br> \put(800,613){\sx{4}{$u\!=\!2$}} %<br> \put(865,500){\sx{4}{\rot{90}$v\!=\!0$\ero}} %<br> \put(872,446){\sx{4}{\rot{46}$u\!=\!1$\ero}} %<br> \put(862,420){\sx{4}{\rot{-46}$u\!=\!1$\ero}} %<br> \put(630,468){\sx{4}{\rot{0}$v\!=\!0.2$\ero}} %<br> \put(630,430){\sx{4}{\rot{0}$v\!=\!0$\ero}} \put(900,430){\sx{4}{\rot{0}$v\!=\!0$\ero}} %<br> \put(628,392){\sx{4}{\rot{0}$v\!=\!-0.2$\ero}} %<br> \put(624,390){\sx{4}{\rot{90}$u\!=\!0$\ero}} %<br> \put(160,390){\sx{4}{\rot{90}$v\!=\!0$\ero}} %<br> \put(312,396){\sx{4}{\rot{90}$u\!=\!0$\ero}} %<br> \put(362,366){\sx{3.8}{\rot{90}$u\!=\!-0.2$\ero}} %<br> \put(428,370){\sx{3.8}{\rot{90}$u\!=\!-0.4$\ero}} %<br> \put(482,396){\sx{4}{\rot{90}$v\!=\!0$\ero}} %<br> \put(1106,390){\sx{4}{\rot{90}$u\!=\!0$\ero}} %<br> \put(1250,390){\sx{4}{\rot{90}$v\!=\!0$\ero}} %<br> \put(1419,390){\sx{4}{\rot{90}$u\!=\!0$\ero}} %<br> \put(1568,390){\sx{4}{\rot{90}$v\!=\!0$\ero}} %<br> \end{picture} %<br> \end{document} %<br> %
References
http://reference.wolfram.com/mathematica/ref/BesselJ.ja.html
File history
Click on a date/time to view the file as it appeared at that time.
| Date/Time | Thumbnail | Dimensions | User | Comment | |
|---|---|---|---|---|---|
| current | 17:50, 20 June 2013 | 1,827 × 932 (1.7 MB) | Maintenance script (talk | contribs) | Importing image file |
You cannot overwrite this file.
File usage
The following page uses this file: