private static void weibull_discrete_cdf_test() //****************************************************************************80 // // Purpose: // // WEIBULL_DISCRETE_CDF_TEST tests WEIBULL_DISCRETE_CDF. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 08 April 2016 // // Author: // // John Burkardt // { int i; int seed = 123456789; Console.WriteLine(""); Console.WriteLine("WEIBULL_DISCRETE_CDF_TEST"); Console.WriteLine(" WEIBULL_DISCRETE_CDF evaluates the Weibull Discrete CDF;"); Console.WriteLine(" WEIBULL_DISCRETE_CDF_INV inverts the Weibull Discrete CDF."); Console.WriteLine(" WEIBULL_DISCRETE_PDF evaluates the Weibull Discrete PDF;"); const double a = 0.5; const double b = 1.5; Console.WriteLine(""); Console.WriteLine(" PDF parameter A = " + a + ""); Console.WriteLine(" PDF parameter B = " + b + ""); if (!Weibull.weibull_discrete_check(a, b)) { Console.WriteLine(""); Console.WriteLine("WEIBULL_DISCRETE_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++) { int x = Weibull.weibull_discrete_sample(a, b, ref seed); double pdf = Weibull.weibull_discrete_pdf(x, a, b); double cdf = Weibull.weibull_discrete_cdf(x, a, b); int x2 = Weibull.weibull_discrete_cdf_inv(cdf, a, b); 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) + ""); } }