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

Needs["Statistics`ContinuousDistributions`"]

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

Do [ {lambda = lambdavec[[i]], x=xvec[[i]],
dist=ExponentialDistribution[lambda],f = CDF[dist,x] ,
fvec = Append [ fvec, f ],
      Print["  ExponentialCDF[",lambda,",",x,"]=",N[f,16]] },{i,1,num,1}]

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