(*  cos_degree_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the cosine (degree) *)
(*    function at selected argument values, *)
(*    and write the data to a file. *)
(* *)
(*  Modified:  22 March 2010 *)
(*  Author:  John Burkardt *)

xvec = { -5, 0, 1, 2, 3, 4, 5, 10, 15, 30, 45, 60, 75, 85, 86, 87, 88, 89, 90, 91, 105, 180 };
fvec = {};
num = Length [ xvec ];

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

fileout=OpenWrite["/Users/burkardt/public_html/math_src/test_values/cos_degree_values.txt"];
SetOptions[fileout,FormatType->TextForm];
Write[fileout,"#  cos_degree_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];