private static void hermite_polynomial_test04() //****************************************************************************80 // // Purpose: // // HERMITE_POLYNOMIAL_TEST04 tests H_POLYNOMIAL_ZEROS. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 19 October 2014 // // Author: // // John Burkardt // { int degree; double[] hz; string title; double[] z; Console.WriteLine(""); Console.WriteLine("HERMITE_POLYNOMIAL_TEST04:"); Console.WriteLine(" H_POLYNOMIAL_ZEROS computes the zeros of H(n,x)"); Console.WriteLine(" Check by calling H_POLYNOMIAL there."); for (degree = 1; degree <= 5; degree++) { z = Hermite.h_polynomial_zeros(degree); title = " Computed zeros for H(" + degree + ",z):"; typeMethods.r8vec_print(degree, z, title); hz = Hermite.h_polynomial_value(degree, degree, z); title = " Evaluate H(" + degree + ",z):"; typeMethods.r8vec_print(degree, hz, title, aIndex: +degree * degree); } }
private static void hermite_polynomial_test01() //****************************************************************************80 // // Purpose: // // HERMITE_POLYNOMIAL_TEST01 tests H_POLYNOMIAL_VALUE. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 25 February 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("HERMITE_POLYNOMIAL_TEST01:"); Console.WriteLine(" H_POLYNOMIAL_VALUES stores values of"); Console.WriteLine(" the physicist's Hermite polynomials."); Console.WriteLine(" H_POLYNOMIAL_VALUE evaluates the polynomial."); Console.WriteLine(""); Console.WriteLine(" Tabulated Computed"); Console.WriteLine(" N X H(N,X) H(N,X) Error"); Console.WriteLine(""); n_data = 0; for (;;) { Burkardt.Values.Hermite.h_polynomial_values(ref n_data, ref n, ref x, ref fx1); if (n_data == 0) { break; } x_vec[0] = x; fx2_vec = Hermite.h_polynomial_value(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) + ""); } }