(*  sqrt_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the sqrt *)
(*    function at selected argument values, *)
(*    and write the data to a file. *)
(* *)
(*  Modified:  22 June 2007 *)
(*  Author:  John Burkardt *)

xvec = {0,1/123456789,9/100,1/10,4/10, 1,2,3,Pi,19,29,71,97,123456789};
fvec = {};
num = Length [ xvec ];

Do [ { x = xvec[[i]], f = Sqrt[x] ,
fvec = Append [ fvec, f ],
      Print[" Sqrt[",N[x,20],"]=",N[f,20]] },{i,1,num,1}]

fileout=OpenWrite["C:\\Documents and Settings\\burkardt.BURKARDTPC\\Desktop\\Misc\\mathematica\\sqrt_values.txt"];
SetOptions[fileout,FormatType->TextForm];
Write[fileout,"#  sqrt_values.txt"];today=DateList[];Write[fileout,"#  Created on ",today];Write[fileout,"#"];
Write[fileout,"#  x  f"];
Write[fileout,"#"];
Do[{x=xvec[[i]];f=fvec[[i]];Write[fileout,N[x,20],"  ",N[f,20]]},{i,1,num,1}];Close[fileout];