(*  elliptic_ka_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the elliptic KA *)
(*    function at selected argument values, *)
(*    and write the data to a file. *)
(* *)
(*  Modified:  11 January 2006 *)
(*  Author:  John Burkardt *)

avec = {};
Do [ { a = i*Pi/180,avec = Append [ avec, a ] },{i,0,85,5}]
fvec = {};
num = Length [ avec ];

Do [ { a = avec[[i]],m=(Sin[a])^2,f = EllipticK[m],
fvec = Append [ fvec, f ],
      Print["  EllipticKA[",a,"]]=",N[f,16]] },{i,1,num,1}]

fileout=OpenWrite["C:\\Documents and Settings\\burkardt\\Desktop\\Misc\\mathematica\\elliptic_ka_values.txt"];
SetOptions[fileout,FormatType->TextForm];
Write[fileout,"#  elliptic_ka_values.txt"];today=DateList[];Write[fileout,"#  Created on ",today];Write[fileout,"#"];
Write[fileout,"#  a  fx"];
Write[fileout,"#"];
Do[{a=avec[[i]];f=fvec[[i]];Write[fileout,N[a,16],"  ",N[f,16]]},{i,1,num,1}];Close[fileout];