(*  cauchy_cdf_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the Cauchy CDF *)
(*    at selected argument values, *)
(*    and write the data to a file. *)
(* *)
(*  Modified:  05 January 2006 *)
(*  Author:  John Burkardt *)

Needs["Statistics`ContinuousDistributions`"]

muvec= {1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5}
sigmavec = {1/2, 1/2, 1/2, 1/2, 2, 3, 4, 5, 2, 2, 2, 2}
xvec={1, 2, 3, 4,2, 2, 2, 2,3, 3, 3, 3}
fvec = {};
num = Length [ xvec ]

Do [ {mu=muvec[[i]], sigma = sigmavec[[i]], x=xvec[[i]],
dist=CauchyDistribution[mu,sigma],f = CDF[dist,x] ,
fvec = Append [ fvec, f ],
      Print["  CauchyCDF[",mu,",",sigma,",",x,"]=",N[f,16]] },{i,1,num,1}]

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