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

xvec = {-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
fvec = {};
num = Length [ xvec ];

n = 1
Do [ { x = xvec[[i]], 
f = BesselJ[n,x] ,
fvec = Append [ fvec, f ],
      Print["  BesselJ[",n,",",x,"]=",N[f,16]] },{i,1,num,1}]

fileout=OpenWrite["/Users/burkardt/public_html/math_src/test_values/bessel_j1_values.txt"];
SetOptions[fileout,FormatType->TextForm];
Write[fileout,"#  bessel_j1_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];