private static void rayleigh_cdf_test() //****************************************************************************80 // // Purpose: // // RAYLEIGH_CDF_TEST tests RAYLEIGH_CDF. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 27 February 2007 // // Author: // // John Burkardt // { int i; int seed = 123456789; Console.WriteLine(""); Console.WriteLine("RAYLEIGH_CDF_TEST"); Console.WriteLine(" RAYLEIGH_CDF evaluates the Rayleigh CDF;"); Console.WriteLine(" RAYLEIGH_CDF_INV inverts the Rayleigh CDF."); Console.WriteLine(" RAYLEIGH_PDF evaluates the Rayleigh PDF;"); const double a = 2.0; Console.WriteLine(""); Console.WriteLine(" PDF parameter A = " + a + ""); if (!Rayleigh.rayleigh_check(a)) { Console.WriteLine(""); Console.WriteLine("RAYLEIGH_CDF_TEST - Fatal error!"); Console.WriteLine(" The parameters are not legal."); return; } Console.WriteLine(""); Console.WriteLine(" X PDF CDF CDF_INV"); Console.WriteLine(""); for (i = 1; i <= 10; i++) { double x = Rayleigh.rayleigh_sample(a, ref seed); double pdf = Rayleigh.rayleigh_pdf(x, a); double cdf = Rayleigh.rayleigh_cdf(x, a); double x2 = Rayleigh.rayleigh_cdf_inv(cdf, a); Console.WriteLine(" " + x.ToString(CultureInfo.InvariantCulture).PadLeft(12) + " " + pdf.ToString(CultureInfo.InvariantCulture).PadLeft(12) + " " + cdf.ToString(CultureInfo.InvariantCulture).PadLeft(12) + " " + x2.ToString(CultureInfo.InvariantCulture).PadLeft(12) + ""); } }