(*  jacobi_cn_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the derivative of the Jacobi CN *)
(*    function at selected argument values, *)
(*    and write the data to a file. *)
(* *)
(*  Modified:  24 January 2006 *)
(*  Author:  John Burkardt *)

avec = {0,0,0,0,0,1/2,1/2,1/2,1/2,1/2,1,1,1,1,1,1,1,1,1,1};
xvec={1/10,2/10,5/10,1,2,1/10,2/10,5/10,1,2,1/10,2/10,5/10,1,2,4,-2/10,-5/10,-1,-2};
fvec = {};
num = Length [ xvec ];

Do [ { a=avec[[i]],x = xvec[[i]], f = JacobiCN[x,a] ,
fvec = Append [ fvec, f],
      Print["  CN[",x,",",a,"]=",N[f,16]] },{i,1,num,1}]

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