private static void normal_truncated_b_cdf_test() //****************************************************************************80 // // Purpose: // // NORMAL_TRUNCATED_B_CDF_TEST tests NORMAL_TRUNCATED_B_CDF. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 11 April 2016 // // Author: // // John Burkardt // { int i; const double b = 150.0; const double mu = 100.0; const double s = 25.0; int seed = 123456789; Console.WriteLine(""); Console.WriteLine("NORMAL_TRUNCATED_B_CDF_TEST"); Console.WriteLine(" NORMAL_TRUNCATED_B_CDF evaluates the Normal Truncated B CDF."); Console.WriteLine(" NORMAL_TRUNCATED_B_CDF_INV inverts the Normal Truncated B CDF."); Console.WriteLine(" NORMAL_TRUNCATED_B_PDF evaluates the Normal Truncated B PDF."); Console.WriteLine(""); Console.WriteLine(" The parent normal distribution has"); Console.WriteLine(" mean = " + mu + ""); Console.WriteLine(" standard deviation = " + s + ""); Console.WriteLine(" The parent distribution is truncated to"); Console.WriteLine(" the interval [-oo," + b + "]"); Console.WriteLine(""); Console.WriteLine(" X PDF CDF CDF_INV"); Console.WriteLine(""); for (i = 1; i <= 10; i++) { double x = Truncated.normal_truncated_b_sample(mu, s, b, ref seed); double pdf = Truncated.normal_truncated_b_pdf(x, mu, s, b); double cdf = CDF.normal_truncated_b_cdf(x, mu, s, b); double x2 = CDF.normal_truncated_b_cdf_inv(cdf, mu, s, b); Console.WriteLine(" " + x.ToString(CultureInfo.InvariantCulture).PadLeft(14) + " " + pdf.ToString(CultureInfo.InvariantCulture).PadLeft(14) + " " + cdf.ToString(CultureInfo.InvariantCulture).PadLeft(14) + " " + x2.ToString(CultureInfo.InvariantCulture).PadLeft(14) + ""); } }