(*  weibull_cdf_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the Weibull CDF *)
(*    at selected argument values, *)
(*    and write the data to a file. *)
(* *)
(*  Modified:  15 February 2006 *)
(*  Author:  John Burkardt *)

Needs["Statistics`ContinuousDistributions`"]

alphavec= {1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5};
betavec = {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 [ {alpha=alphavec[[i]], beta = betavec[[i]], x=xvec[[i]],
dist=WeibullDistribution[alpha,beta],f = CDF[dist,x] ,
fvec = Append [ fvec, f ],
      Print["  WeibullCDF[",alpha,",",beta,",",x,"]=",N[f,16]] },{i,1,num,1}]

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