(*  psi_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the Psi *)
(*    function at selected argument values, *)
(*    and write the data to a file. *)
(* *)
(*  Modified: 04 June 2013 *)
(*  Author:  John Burkardt *)

xvec = { 1/10, 2/10, 3/10, 4/10,
5/10, 6/10, 7/10, 8/10, 9/10,
10/10, 11/10, 12/10, 13/10, 14/10,
15/10, 16/10, 17/10, 18/10, 19/10,
20 /10 };
fvec = {};
num = Length [ xvec ];

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

fileout=OpenWrite["/panfs/panasas1/users/jburkardt/public_html/math_src/test_values/psi_values.txt"];
SetOptions[fileout,FormatType->TextForm];
Write[fileout,"#  psi_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];