(*  ei_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the Exponential Integral *)
(*    function Ei(x) at selected argument values, *)
(*    and write the data to a file. *)
(* *)
(*  Modified:  10 January 2006 *)
(*  Author:  John Burkardt *)

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

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

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