(*  log_series_cdf_values.nb *)
(* *)
(*  Purpose: *)
(*    Evaluate the Log Series CDF *)
(*    at selected argument values, *)
(*    and write the data to a file. *)
(* *)
(*  Modified:  31 January 2006 *)
(*  Author:  John Burkardt *)

Needs["Statistics`DiscreteDistributions`"]

xvec={
1/10, 1/9,1/8,1/7,1/6, 1/5, 1/4, 1/3, 1/2, 2/3, 
3/4, 4/5, 5/6, 6/7, 7/8, 8/9, 9/10,
99/100, 99/100, 99/100, 
99/100, 99/100, 99/100, 99/100, 99/100, 99/100, 99/100, 99/100, 99/100};
nvec = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1,1,1,1,1,1,1,1, 0, 1,
 2, 3, 4, 5, 6, 7, 8, 9, 10};
fvec = {};
num = Length [ xvec ];

Do[{ n = nvec[[i]], x = xvec[[i]],
dist = LogSeriesDistribution[x], f = N[CDF[dist,n],16],
fvec = Append [ fvec, f ],
Print["LogSeriesCDF[",x,"](",n,")=",f]
}, {i, 1, num,1}]

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