private static void pareto_cdf_test() //****************************************************************************80 // // Purpose: // // PARETO_CDF_TEST tests PARETO_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("PARETO_CDF_TEST"); Console.WriteLine(" PARETO_CDF evaluates the Pareto CDF;"); Console.WriteLine(" PARETO_CDF_INV inverts the Pareto CDF."); Console.WriteLine(" PARETO_PDF evaluates the Pareto PDF;"); const double a = 0.5; const double b = 5.0; Console.WriteLine(""); Console.WriteLine(" PDF parameter A = " + a + ""); Console.WriteLine(" PDF parameter B = " + b + ""); if (!Pareto.pareto_check(a, b)) { Console.WriteLine(""); Console.WriteLine("PARETO_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 = Pareto.pareto_sample(a, b, ref seed); double pdf = Pareto.pareto_pdf(x, a, b); double cdf = Pareto.pareto_cdf(x, a, b); double x2 = Pareto.pareto_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) + ""); } }