(*  sin_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the sine *)
(*    function at selected argument values, *)
(*    and write the data to a file. *)
(* *)
(*  Modified:  12 June 2007 *)
(*  Author:  John Burkardt *)

xvec = { 0/12, Pi/12, 6/12, 2 Pi/12, 3 Pi/12, 12/12,4 Pi/12, 6Pi/12, 2, 3, Pi, 4, 5 };
fvec = {};
num = Length [ xvec ];

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

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