private static void lobatto_polynomial_plot_test() //****************************************************************************80 // // Purpose: // // LOBATTO_POLYNOMIAL_PLOT_TEST tests LOBATTO_POLYNOMIAL_PLOT. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 20 November 2014 // // Author: // // John Burkardt // { int[] ndx = { 1, 2, 3, 4, 5, 6, 7 }; int ndx_num = 7; string prefix = "test"; Console.WriteLine(""); Console.WriteLine("LOBATTO_POLYNOMIAL_PLOT_TEST:"); Console.WriteLine(" LOBATTO_POLYNOMIAL_PLOT plots Lobatto polynomials."); Lobatto.lobatto_polynomial_plot(ndx_num, ndx, prefix); }
public static void lobatto_polynomial_values_test() //****************************************************************************80 // // Purpose: // // LOBATTO_POLYNOMIAL_VALUES_TEST tests LOBATTO_POLYNOMIAL_VALUES. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 02 May 2013 // // Author: // // John Burkardt // { double fx = 0; int n = 0; double x = 0; Console.WriteLine(""); Console.WriteLine("LOBATTO_POLYNOMIAL_VALUES_TEST:"); Console.WriteLine(" LOBATTO_POLYNOMIAL_VALUES stores values of "); Console.WriteLine(" the completed Lobatto polynomials."); Console.WriteLine(""); Console.WriteLine(" N X Lo(N)(X)"); Console.WriteLine(""); int n_data = 0; for (;;) { Lobatto.lobatto_polynomial_values(ref n_data, ref n, ref x, ref fx); if (n_data == 0) { break; } Console.WriteLine(" " + n.ToString().PadLeft(6) + " " + x.ToString(CultureInfo.InvariantCulture).PadLeft(12) + " " + fx.ToString("0.################").PadLeft(24) + ""); } }
private static void lobatto_polynomial_value_test() //****************************************************************************80 // // Purpose: // // LOBATTO_POLYNOMIAL_VALUE_TEST tests LOBATTO_POLYNOMIAL_VALUE. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 20 November 2014 // // Author: // // John Burkardt // { double fx1 = 0; int n = 0; double x = 0; double[] xvec = new double[1]; const int m = 1; Console.WriteLine(""); Console.WriteLine("LOBATTO_POLYNOMIAL_VALUE_TEST:"); Console.WriteLine(" LOBATTO_POLYNOMIAL_VALUES stores values of"); Console.WriteLine(" the completed Lobatto polynomial L(n,x)."); Console.WriteLine(" LOBATTO_POLYNOMIAL_VALUE evaluates the completed Lobatto polynomial."); Console.WriteLine(""); Console.WriteLine(" Tabulated Computed"); Console.WriteLine(" N X L(N,X) L(N,X) Error"); Console.WriteLine(""); int n_data = 0; for (;;) { Lobatto.lobatto_polynomial_values(ref n_data, ref n, ref x, ref fx1); if (n_data == 0) { break; } xvec[0] = x; double[] l = Lobatto.lobatto_polynomial_value(m, n, xvec); double fx2 = l[0 + (n - 1) * m]; double e = fx1 - fx2; Console.WriteLine(" " + n.ToString(CultureInfo.InvariantCulture).PadLeft(4) + " " + x.ToString(CultureInfo.InvariantCulture).PadLeft(12) + " " + fx1.ToString(CultureInfo.InvariantCulture).PadLeft(12) + " " + fx2.ToString(CultureInfo.InvariantCulture).PadLeft(12) + " " + e.ToString(CultureInfo.InvariantCulture).PadLeft(8) + ""); } }