(*  tan_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the tangent *)
(*    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, 5 Pi/12,  11Pi/24,23Pi/48, 2, 3, Pi, 4, 5 };
fvec = {};
num = Length [ xvec ];

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

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