public static void p_polynomial_coefficients_test() //****************************************************************************80 // // Purpose: // // P_POLYNOMIAL_COEFFICIENTS_TEST tests P_POLYNOMIAL_COEFFICIENTS. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 14 March 2012 // // Author: // // John Burkardt // { int i; const int n = 10; Console.WriteLine(""); Console.WriteLine("P_POLYNOMIAL_COEFFICIENTS_TEST"); Console.WriteLine(" P_POLYNOMIAL_COEFFICIENTS: coefficients of Legendre polynomial P(n,x)."); double[] c = Legendre.p_polynomial_coefficients(n); for (i = 0; i <= n; i++) { Console.WriteLine(""); Console.WriteLine(" P(" + i + ",x) ="); Console.WriteLine(""); int j; for (j = i; 0 <= j; j--) { switch (c[i + j * (n + 1)]) { case 0.0: break; default: switch (j) { case 0: Console.WriteLine(c[i + j * (n + 1)].ToString(CultureInfo.InvariantCulture).PadLeft(14) + ""); break; case 1: Console.WriteLine(c[i + j * (n + 1)].ToString(CultureInfo.InvariantCulture).PadLeft(14) + " * x"); break; default: Console.WriteLine(c[i + j * (n + 1)].ToString(CultureInfo.InvariantCulture).PadLeft(14) + " * x^" + j + ""); break; } break; } } } }