(*  erfc_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the derivative of the Complementary *)
(*    Error function at selected argument values, *)
(*    and write the data to a file. *)
(* *)
(*  Modified:  20 May 2007 *)
(*  Author:  John Burkardt *)

xvec = {};
Do [ { x = i/5, xvec = Append [ xvec, x] },
{ i, 0, 20, 1 } ]
fvec = {};
num = Length [ xvec ];

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

fileout=OpenWrite["C:\\Documents and Settings\\burkardt.BURKARDTPC\\Desktop\\Misc\\mathematica\\erfc_values.txt"];
SetOptions[fileout,FormatType->TextForm];
Write[fileout,"#  erfc_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];