(* arctan2_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the arctan2 *)
(*    function at selected argument values, *)
(*    and write the data to a file. *)
(* *)
(*  Modified:  28 March 2010 *)
(*  Author:  John Burkardt *)

xvec={};
yvec={};
Do[{t=i 2Pi/12,x=Cos[t],xvec=Append[xvec,x],y=Sin[t],yvec=Append[yvec,y]},{i,-3,15,1}];
fvec = {};
num = Length [ xvec ];

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

fileout=OpenWrite["/Users/burkardt/public_html/math_src/test_values/arctan2_values.txt"];
SetOptions[fileout,FormatType->TextForm];
Write[fileout,"#  arctan2_values.txt"];today=DateList[];Write[fileout,"#  Created on ",today];Write[fileout,"#"];
Write[fileout,"#  x  y  f"];
Write[fileout,"#"];
Do[{x=xvec[[i]];y=yvec[[i]];f=fvec[[i]];Write[fileout,N[x,20],"  ",N[y,20],"  ",N[f,20]]},{i,1,num,1}];Close[fileout];