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

Needs["Statistics`ContinuousDistributions`"]

sigmavec = {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 [ {sigma = sigmavec[[i]], x=xvec[[i]],
dist=RayleighDistribution[sigma],f = CDF[dist,x] ,
fvec = Append [ fvec, f ],
      Print["  RayleighCDF[",sigma,",",x,"]=",N[f,16]] },{i,1,num,1}]

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