private static void chi_square_sample_test() //****************************************************************************80 // // Purpose: // // CHI_SQUARE_SAMPLE_TEST tests CHI_SQUARE_SAMPLE. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 24 January 2007 // // Author: // // John Burkardt // { const int SAMPLE_NUM = 1000; int j; int seed = 123456789; double[] x = new double[SAMPLE_NUM]; Console.WriteLine(""); Console.WriteLine("CHI_SQUARE_SAMPLE_TEST"); Console.WriteLine(" CHI_SQUARE_MEAN computes the Chi Square mean;"); Console.WriteLine(" CHI_SQUARE_SAMPLE samples the Chi Square distribution;"); Console.WriteLine(" CHI_SQUARE_VARIANCE computes the Chi Square variance."); double a = 10.0E+00; Console.WriteLine(""); Console.WriteLine(" PDF parameter A = " + a + ""); if (!Chi.chi_square_check(a)) { Console.WriteLine(""); Console.WriteLine("CHI_SQUARE_SAMPLE_TEST - Fatal error!"); Console.WriteLine(" The parameters are not legal."); return; } double mean = Chi.chi_square_mean(a); double variance = Chi.chi_square_variance(a); Console.WriteLine(" PDF mean = " + mean + ""); Console.WriteLine(" PDF variance = " + variance + ""); for (j = 0; j < SAMPLE_NUM; j++) { x[j] = Chi.chi_square_sample(a, ref seed); } mean = typeMethods.r8vec_mean(SAMPLE_NUM, x); variance = typeMethods.r8vec_variance(SAMPLE_NUM, x); double xmax = typeMethods.r8vec_max(SAMPLE_NUM, x); double xmin = typeMethods.r8vec_min(SAMPLE_NUM, x); Console.WriteLine(""); Console.WriteLine(" Sample size = " + SAMPLE_NUM + ""); Console.WriteLine(" Sample mean = " + mean + ""); Console.WriteLine(" Sample variance = " + variance + ""); Console.WriteLine(" Sample maximum = " + xmax + ""); Console.WriteLine(" Sample minimum = " + xmin + ""); }