public static void laguerre_polynomial_test03() //****************************************************************************80 // // Purpose: // // LAGUERRE_POLYNOMIAL_TEST03 tests L_POLYNOMIAL_ZEROS. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 11 March 2012 // // Author: // // John Burkardt // { int degree; double[] hz; string title; double[] z; Console.WriteLine(""); Console.WriteLine("LAGUERRE_POLYNOMIAL_TEST03:"); Console.WriteLine(" L_POLYNOMIAL_ZEROS computes the zeros of L(n,x)"); Console.WriteLine(" Check by calling L_POLYNOMIAL there."); for (degree = 1; degree <= 5; degree++) { z = Laguerre.l_polynomial_zeros(degree); title = " Computed zeros for L(" + degree + ",z):"; typeMethods.r8vec_print(degree, z, title); hz = Laguerre.l_polynomial(degree, degree, z); title = " Evaluate L(" + degree + ",z):"; typeMethods.r8vec_print(degree, hz, title, aIndex: +degree * degree); } }
public static void laguerre_polynomial_test01() //****************************************************************************80 // // Purpose: // // LAGUERRE_POLYNOMIAL_TEST01 tests L_POLYNOMIAL. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 11 March 2012 // // Author: // // John Burkardt // { int n_data; double e; double fx1 = 0; double fx2; double[] fx2_vec; int n = 0; double x = 0; double[] x_vec = new double[1]; Console.WriteLine(""); Console.WriteLine("LAGUERRE_POLYNOMIAL_TEST01:"); Console.WriteLine(" L_POLYNOMIAL_VALUES stores values of"); Console.WriteLine(" the Laguerre polynomials."); Console.WriteLine(" L_POLYNOMIAL evaluates the polynomial."); Console.WriteLine(""); Console.WriteLine(" Tabulated Computed"); Console.WriteLine(" N X L(N,X) L(N,X) Error"); Console.WriteLine(""); n_data = 0; for (;;) { Laguerre.l_polynomial_values(ref n_data, ref n, ref x, ref fx1); if (n_data == 0) { break; } x_vec[0] = x; fx2_vec = Laguerre.l_polynomial(1, n, x_vec); fx2 = fx2_vec[n]; e = fx1 - fx2; Console.WriteLine(" " + n.ToString().PadLeft(4) + " " + x.ToString().PadLeft(12) + " " + fx1.ToString("0.################").PadLeft(24) + " " + fx2.ToString("0.################").PadLeft(24) + " " + e.ToString().PadLeft(8) + ""); } }