(* agm_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the Arithmetic Geometric Mean *)
(*    for selected argument values, *)
(*    and write the data to a file. *)
(* *)
(*  Modified:  09 February 2008 *)
(*  Author:  John Burkardt *)

avec = { 22, 83, 42, 26, 4, 6, 40, 80, 90, 9, 53, 1, 1, 1, 15/10 };
bvec = {96,56,7,11,63,45,75,0,35,1, 53, 2, 4, 8, 8 };
fvec = {};
num = Length [ avec ];

Do [ { a = avec[[i]], b = bvec[[i]],f = ArithmeticGeometricMean[a,b] ,
fvec = Append [ fvec, f ],
      Print["  AGM[",a,",",b,"]=",N[f,20]] },{i,1,num,1}]

fileout=OpenWrite["/Users/burkardt/public_html/math_src/test_values/agm_values.txt"];SetOptions[fileout,FormatType->TextForm];Write[fileout,"#  agm_values.txt"];
today=DateList[];
Write[fileout,"#  Created on ",today];
 Write[fileout,"#"];
Write[fileout,"#  a   b  f"];
 Write[fileout,"#"];

Do[{a=avec[[i]],b = bvec[[i]],f=fvec[[i]];
Write[fileout,N[a,20],"  ",N[b,20],"  ",N[f,20]]},{i,1,num,1}] ;
Close[fileout];