(*  bessel_j0_spherical_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the Bessel J0 spherical *)
(*    function at selected argument values fx(x), *)
(*    and write the data to a file. *)
(* *)
(*  Modified:  14 December 2005 *)
(*  Author:  John Burkardt *)

num = 0
fvec = {};
xvec = {};

n = 0;
x = 1/10;
f=Sqrt[Pi/(2*x)]*BesselJ[n+1/2,x];
xvec = Append [ xvec, x ];
fvec = Append [ fvec, f ];
Print["  j0[",x,"]=",N[f,16]]

Do [ { x = 2*i/10, f = Sqrt[Pi/(2*x)]*BesselJ[n+1/2,x] ,
xvec = Append[xvec,x],
fvec = Append[fvec, f],
      Print["  j0[",x,"]=",N[f,16]] },{i,1,20,1}]
num = Length [ xvec ];

fileout=OpenWrite["/Users/burkardt/public_html/math_src/test_values/bessel_j0_spherical_values.txt"];
SetOptions[fileout,FormatType->TextForm];
Write[fileout,"#  bessel_j0_spherical_values.txt"];today=DateList[];Write[fileout,"#  Created on ",today];Write[fileout,"#"];
Write[fileout,"#  x  fx"];
Write[fileout,"#"];
Do[{x=xvec[[i]];f=fvec[[i]];Write[fileout,N[x,16],"  ",N[f,16]]},{i,1,num,1}];Close[fileout];