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

Needs["Statistics`DiscreteDistributions`"]

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

Do[{ a = avec[[i]], x= xvec[[i]],
dist = PoissonDistribution[a], f = N[CDF[dist,x],16],
fvec = Append [ fvec, f ],
Print["PoissonCDF[",a,"](",x,")=",f]
}, {i, 1, num,1}]

fileout=OpenWrite["C:\\Documents and Settings\\burkardt\\Desktop\\Misc\\mathematica\\poisson_cdf_values.txt"];
SetOptions[fileout,FormatType->TextForm];
Write[fileout,"#  poisson_cdf_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];