private static void chi_square_cdf_test() //****************************************************************************80 // // Purpose: // // CHI_SQUARE_CDF_TEST tests CHI_SQUARE_CDF. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 24 January 2007 // // Author: // // John Burkardt // { int i; int seed = 123456789; Console.WriteLine(""); Console.WriteLine("CHI_SQUARE_CDF_TEST"); Console.WriteLine(" CHI_SQUARE_CDF evaluates the Chi Square CDF;"); Console.WriteLine(" CHI_SQUARE_CDF_INV inverts the Chi Square CDF."); Console.WriteLine(" CHI_SQUARE_PDF evaluates the Chi Square PDF;"); const double a = 4.0E+00; Console.WriteLine(""); Console.WriteLine(" PDF parameter A = " + a + ""); if (!Chi.chi_square_check(a)) { Console.WriteLine(""); Console.WriteLine("CHI_SQUARE_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 = Chi.chi_square_sample(a, ref seed); double pdf = Chi.chi_square_pdf(x, a); double cdf = Chi.chi_square_cdf(x, a); double x2 = Chi.chi_square_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) + ""); } }