File:Bessel8TestStep.jpg

Test of the 0-order discrete Bessel transform at the grid of 8 points with the step function

$f(x)=\mathrm{UnitStep}(2\!-\!x)$

shown with green line.

The discrete representation is shown with small red circles.

The Discrete Bessel transform is shown with big blue circles.

The exact Bessel transform is

$\displaystyle g(x)=\int_0^\infty J_0(xy) \, f(y)\, y \, \mathrm d y = \int_0^2 J_0(xy) \, y \, \mathrm d y =2J_1(2x)/x $

is shown with black curve. It shows qualitative agreement with the discrete Bessel transform, shown with circles.

C++ Generator of curves
DB jnp(int n,DB x){ return .5*( jn(n-1,x)-jn(n+1,x) ) ; } // Derivative of n th Bessel DB jnz(int v, int k){ DB x,t; t=M_PI*(k+.5*v-.25); x= t - (v*v-.25)*.5/t; x-= jn(v,x)/jnp(v,x); // Newton adjustment of the root x-= jn(v,x)/jnp(v,x); x-= jn(v,x)/jnp(v,x); return x; } // the k th zero of v th Bessel 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 {.04 0 360 arc C S} bind def\n"); fprintf(O,"/o {.02 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");} //#include"ado.cin"
 * 1) include
 * 2) include
 * 3) include
 * 4) define DB double
 * 5) define DO(x,y) for(x=0;x<y;x++)

int main{ int m,n,v,k; DB s, x,y; FILE *o; int M=8; DB X[M+1],W[M+1],T[M+1][M+1],TT[M+1][M+1], F[M],G[M]; DB S=jnz(0,M+1); DB qs=sqrt(1./S); DB q=sqrt(2./S); for(n=1;n<M+1;n++){    x=jnz(0,n); X[n]=x*qs; y=W[n]=q/fabs(j1(x)); printf("%3d %20.16lf %20.16lf\n",n,X[n],W[n]); } for(m=1;m<=M;m++){ printf("%2d",m); for(n=1;n<=M;n++){ T[m][n]=W[m]*j0(X[m]*X[n])*W[n]; }} for(m=1;m<=M;m++){printf("\n"); for(n=1;n<=M;n++){printf("%14.10lf",T[m][n]);  }} printf("\n"); for(m=1;m<=M;m++){printf("\n"); for(n=1;n<=M;n++){     s=0.; for(k=1;k<=M;k++) s+=T[m][k]*T[k][n] ; TT[m][n]=s;printf("%14.10lf",TT[m][n]); }} printf("\n\n"); //for(m=1;m<=M;m++){x=X[m]; y=exp(-x*x/2.); F[m]=y*W[m]; printf("%14.10lf",F[m]); } for(m=1;m<=M;m++){x=X[m]; y=1.; if(x>2) y=0.; F[m]=y*W[m]; printf("%14.10lf",F[m]); } printf("\n"); for(m=1;m<=M;m++){ s=0.; for(n=1;n<=M;n++) s+=T[m][n]*F[n]; G[m]=s;} for(m=1;m<=M;m++) printf("%14.10lf",G[m]); printf("\n"); //o=fopen("10.eps", "w"); ado(o,520,250); o=fopen("bessel8testSte.eps", "w"); ado(o,520,250); fprintf(o,"10 40 translate 100 100 scale\n"); DO(n,6){M(n,2)L(n,0)} DO(n,5){M(0,n/2.)L(5,n/2.)} fprintf(o,"2 setlinecap 2 setlinejoin .006 W S\n"); M(0,1)L(2,1)L(2,0)L(5,0) fprintf(o,"1 setlinecap 1 setlinejoin .012 W 0 .6 0 RGB S 0 0 0 RGB\n"); //M(0,1) DO(n,500){x=.01*(n+1); y=exp(-x*x/2.); L(x,y)} //fprintf(o,"1 setlinecap 1 setlinejoin S\n"); //DO(n,500){x=.01*(n+.1); y=2.*j1(2*x)/x;if(n==0) M(x,y) else L(x,y)} //fprintf(o,"1 setlinecap 1 setlinejoin S\n"); M(0,2) DO(n,508){x=.01*(n+1); y=2.*j1(2*x)/x;L(x,y)} // strange.. fprintf(o,"0 0 0 RGB .012 W S\n"); fprintf(o,"1 0 0 RGB .016 W\n"); for(m=1;m<=M;m++) o(X[m],F[m]/W[m]) fprintf(o,"0 0 1 RGB .012 W\n"); for(m=1;m<=M;m++) O(X[m],G[m]/W[m]) fprintf(o,"showpage\n%c%cTrailer\n",'%','%'); fclose(o); system("epstopdf bessel8testSte.eps"); system("open    bessel8testSte.pdf"); return 0;}
 * 1) define M(x,y) fprintf(o,"%8.4lf %8.4lf M\n",0.+x, 0.+y);
 * 2) define L(x,y) fprintf(o,"%8.4lf %8.4lf L\n",0.+x, 0.+y);
 * 3) define O(x,y) fprintf(o,"%8.4lf %8.4lf O\n",0.+x, 0.+y);
 * 4) define o(x,y) fprintf(o,"%8.4lf %8.4lf o\n",0.+x, 0.+y);

Latex Generator of labels
\documentclass[12pt]{article} \usepackage{geometry} \usepackage{graphicx} \usepackage{rotating} \paperwidth 514pt \paperheight 234pt \topmargin -110pt \oddsidemargin -92pt \newcommand \ing {\includegraphics} \newcommand \sx {\scalebox} \newcommand \rot {\begin{rotate}} \newcommand \ero {\end{rotate}} \begin{document} \begin{picture}(410,248) \put(2,4){\ing{bessel8testSte}} \put(2,238){\sx{1.4}{$y$}} %\put(1,189){\sx{1.4}{$\frac 3 2$}} \put(2,139){\sx{1.4}{$1$}} %\put(1,89){\sx{1.4}{$\frac 1 2$}} \put(2,39){\sx{1.4}{0}} \put(10,30){\sx{1.4}{0}} \put(108,30){\sx{1.4}{1}} \put(208,30){\sx{1.4}{2}} \put(308,30){\sx{1.4}{3}} \put(409,30){\sx{1.4}{4}} \put(504,30){\sx{1.5}{$x$}} \put(123,114){\sx{1.4}{\rot{-52}$y\!=\! 2 J_1(2x)/x$\ero }} \put(184,141){\sx{1.2}{step }} \put(210,134){\sx{1.2}{\rot{-90}step\ero }} \end{picture} \end{document}