File:Besselj1mapT080.png: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Dmitrii Kouznetsov
m (shorten description)
(== Summary == Importing file)
Tag: Server-side upload
 
(5 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Summary ==
== Summary ==
{{Image_Details|user
Importing file
|description  = [[Complex map]] of the [[Bessel function]], <math>u+\mathrm i v=J_0(x+\mathrm i y)</math>
|author      = [[User:Dmitrii Kouznetsov|Dmitrii Kouznetsov]]
|date-created = 2012 April 29
|pub-country  = [[Japan]]
|notes        = Copy from
<ref name="besselj0map">
http://tori.ils.uec.ac.jp/TORI/index.php/File:Besselj0map1T080.png
Complex map of the Bessel function BesselJ0
f=BesselJ0(x+iy) is shown in the x,y plane with lines u=ℜ(f)=const and lines v=ℑ(f)=const.</ref>
 
</ref>
|versions    = http://tori.ils.uec.ac.jp/TORI/index.php/File:Besselj0map1T080.png
}}
 
==Generators==
==Implementation of [[BesselJ1]]==
// The file below should be stored as [[besselj1.cin]] in the working directory
 
// BesselJ[1,z] implementation:
z_type BesselJ1o(z_type z){ int n; z_type c,s,t;
s=1.; c=1.; t=-z*z/4.;
for(n=1;n<30;n++) {c/=0.+n*n; c*=t; s+=c/(1.+n);}
return s*z/2.;}
 
z_type BesselJ1B(z_type z){ int n; z_type a,f,c,s,t,u,v;
f=M_PI/4.+z; c=cos(f); s=sin(f); a=sqrt(2./M_PI/z); t=1./(z*z);
u= (( (( (( (( (
11587123363874217382000061956546875./302231454903657293676544.*t
- 531595142508493798628972203125./1180591620717411303424.)*t
  + 61394155884765868567528125./9223372036854775808.)*t
      -1149690375852815671875./9007199254740992.)*t
        + 232376754295310625./70368744177664.) * t
          - 33424574007825./274877906944. ) * t
            + 14783093325./2147483648.  ) * t
                - 2837835./4194304.      ) * t
                  + 4725./32768.        ) * t
                  - 15./128.          ) *t
                    -1. ;
v= (((((((( (
- 38190914185478633427818266171875./9444732965739290427392.*t
+3918391713821821611515765625./73786976294838206464.)*t
  -64152722972587114490625./72057594037927936.)*t
    + 11100458801337530625./562949953421312.)*t
      - 1327867167401775./2199023255552. )*t
          + 468131288625./17179869184.  )*t
            - 66891825./33554432.      )*t
              + 72765./262144.        )*t
                - 105./1024.          )*t
              + 3./8.            )/z;
return (c*u+s*v)*a;
}
 
z_type BesselJ1(z_type z){ DB x,y; x=Re(z)/12.6; y=Im(z)/18.5;
if(x*x+y*y<1.) return BesselJ1o(z);
if(x<0) return - BesselJ1B(-z);
        return  BesselJ1B(z);
}
// Copyleft 2012 by Dmitrii Kouznetsov.
// The code above is supposed to return $J_1(z)$ with a dozen correct decimal digits for any complex(double) $z$
 
==Generator of curves==
File [[besselj1.cin]] above and files [[ado.cin]] and [[conto.cin]] should be loaded to the working directory in order to compile the [[C++]] code below. The name besselj1map.cc is suggested for this code.
 
#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 "besselj1.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("besselj1map.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=BesselJ1(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 besselj1map.eps");
      system(    "open besselj1map.pdf");           
      getchar(); system("killall Preview");//for mac
}
// Copyleft 2012 by Dmitrii Kouznetsov
 
==Generator of labels==
 
File [[besselj1map.pdf]] should be generated with the [[C++]] code above and stored in the working directory; then the [[Latex]] document below (let it be stored as Besselj1mapT.tex ) can be compiled.
<nowiki>
\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{besselj1mapsmall}}} % small and fast version for debugging <br>
\put(40,30){\sx{10}{\ing{besselj1map}}} % <br>
%\put(40,30){\sx{10}{\ing{10}}} %draft <br>
\zoomax % <br>
\put(270,430){\sx{4}{\rot{0}$v\!=\!0$\ero}} % <br>
\put(600,430){\sx{4}{\rot{0}$v\!=\!0$\ero}} % <br>
\put(990,430){\sx{4}{\rot{0}$v\!=\!0$\ero}} % <br>
\put(1340,430){\sx{4}{\rot{0}$v\!=\!0$\ero}} % <br>
\put(450,602){\sx{4}{\rot{0}$v\!=\!1$\ero}}  \put(780,590){\sx{4}{\rot{0}$v\!=\!-1$\ero}} % <br>
\put(450,386){\sx{3}{\rot{0}$v\!=\!0.2$\ero}}  \put(780,389){\sx{3}{\rot{0}$v\!=\!-0.2$\ero}} % <br>
\put(450,344){\sx{3}{\rot{0}$v\!=\!0.4$\ero}}  \put(780,356){\sx{3}{\rot{0}$v\!=\!-0.4$\ero}} % <br>
\put(161,480){\sx{4}{\rot{86}$u\!=\!0$\ero}} % <br>
\put(480,480){\sx{4}{\rot{80}$u\!=\!0$\ero}} % <br>
\put(775,460){\sx{3}{\rot{72}$u\!=\!0.4$\ero}} % <br>
\put(865,472){\sx{4}{\rot{90}$u\!=\!0$\ero}} % <br>
\put(949,455){\sx{3}{\rot{109}$u\!=\!-0.4$\ero}} % <br>
\put(1250,480){\sx{4}{\rot{99}$u\!=\!0$\ero}} % <br>
\put(1569,480){\sx{4}{\rot{95}$u\!=\!0$\ero}} % <br>
\end{picture} <br>
\end{document} %  <br>
 
%Copyleft 2012 by Dmitrii Kouznetsov
</nowiki>
 
==Generator of png==
Unfortunately, CZ does not allow to use the PDF images.
The [[besselj1mapT.pdf]] generated withe the code above is converted to the PNG format with resolution 80 pixels/inch.
 
 
== Licensing ==
{{CC|by|3.0}}
 
==References==
<references/>

Latest revision as of 18:54, 11 March 2022

Summary

Importing file

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current18:54, 11 March 2022Thumbnail for version as of 18:54, 11 March 20222,056 × 1,048 (1.72 MB)Maintenance script (talk | contribs)== Summary == Importing file

The following page uses this file:

Metadata