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

Needs["Statistics`ContinuousDistributions`"]

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

Do [ {mu=muvec[[i]], beta = betavec[[i]], x=xvec[[i]],
dist=LaplaceDistribution[mu,beta],f = CDF[dist,x] ,
fvec = Append [ fvec, f ],
      Print["  LaplaceCDF[",mu,",",beta,",",x,"]=",N[f,16]] },{i,1,num,1}]

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