private static void hpp_test03() //****************************************************************************80 // // Purpose: // // HPP_TEST03 tests HEPP_VALUE. // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 22 October 2014 // // Author: // // John Burkardt // { double[] c; int[] e; int i; int[] l; int m = 3; int n = 1; int o = 0; int o_max; int rank; int seed; double[] v1; double[] v2; double[] x; double xhi; double xlo; string cout = ""; Console.WriteLine(""); Console.WriteLine("HPP_TEST03:"); Console.WriteLine(" HEPP_VALUE evaluates a Hermite product polynomial."); Console.WriteLine(" POLYNOMIAL_VALUE evaluates a polynomial."); xlo = -1.0; xhi = +1.0; seed = 123456789; x = UniformRNG.r8vec_uniform_ab_new(m, xlo, xhi, ref seed); Console.WriteLine(""); cout = " Evaluate at X = "; for (i = 0; i < m; i++) { cout += " " + x[i + 0 * m]; } Console.WriteLine(cout); Console.WriteLine(""); Console.WriteLine(" Rank I1 I2 I3: He(I1,X1)*He(I2,X2)*He(I3,X3) P(X1,X2,X3)"); Console.WriteLine(""); for (rank = 1; rank <= 20; rank++) { l = Comp.comp_unrank_grlex(m, rank); // // Evaluate the HePP directly. // v1 = Hermite.hepp_value(m, n, l, x); // // Convert the HePP to a polynomial. // o_max = 1; for (i = 0; i < m; i++) { o_max = o_max * (l[i] + 2) / 2; } c = new double[o_max]; e = new int[o_max]; Hermite.hepp_to_polynomial(m, l, o_max, o, ref c, ref e); // // Evaluate the polynomial. // v2 = Polynomial.polynomial_value(m, o, c, e, n, x); // // Compare results. // Console.WriteLine(rank.ToString().PadLeft(6) + " " + l[0].ToString().PadLeft(2) + " " + l[1].ToString().PadLeft(2) + " " + l[2].ToString().PadLeft(2) + " " + v1[0].ToString().PadLeft(14) + " " + v2[0].ToString().PadLeft(14) + ""); } }