(*  dawson_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the Dawson integral function *)
(*    function at selected argument values, *)
(*    and write the data to a file. *)
(* *)
(*  Modified:  08 January 2006 *)
(*  Author:  John Burkardt *)

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

Do [ { x = xvec[[i]],f = -Sqrt[Pi]*Exp[-x^2]*I*Erf[I*x]/2,
fvec = Append [ fvec, f ],
      Print["  Dawson[",x,"]]=",N[f,16]] },{i,1,num,1}]

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