(*  lambert_w_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the Lambert W *)
(*    function at selected argument values, *)
(*    and write the data to a file. *)
(* *)
(*  Modified:  28 January 2006 *)
(*  Author:  John Burkardt *)

xvec = { 0, 1/2, 1, 3/2, 2, 
5/2, E, 3, 7/2, 4, 
9/2, 5, 11/2, 6, 13/2,
7, 15/2, 8, 10, 100,
1000, 1000000 } ;
fvec = {};
num = Length [ xvec];

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

fileout=OpenWrite["C:\\Documents and Settings\\burkardt\\Desktop\\Misc\\mathematica\\lambert_w_values.txt"];
SetOptions[fileout,FormatType->TextForm];
Write[fileout,"#  lambert_w_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,16],"  ",N[f,16]]},{i,1,num,1}];Close[fileout];