private static void roots_to_r8poly_test() //****************************************************************************80 // // Purpose: // // roots_to_typeMethods.r8poly_test tests roots_to_r8poly(); // // Licensing: // // This code is distributed under the GNU LGPL license. // // Modified: // // 18 January 2007 // // Author: // // John Burkardt // { const int MAXROOT = 5; double[] c = new double[MAXROOT + 1]; int nc = 0; double[] roots = new double[MAXROOT]; Console.WriteLine(""); Console.WriteLine("roots_to_typeMethods.r8poly_test"); Console.WriteLine(" roots_to_r8poly() computes polynomial coefficients from roots."); Console.WriteLine(""); int nroot = 1; roots[0] = 3.0; typeMethods.r8vec_print(nroot, roots, " The roots:"); Roots.roots_to_r8poly(nroot, roots, ref nc, ref c); typeMethods.r8poly_print(nc, c, " The polynomial:"); nroot = 2; roots[0] = 3.0; roots[1] = 1.0; typeMethods.r8vec_print(nroot, roots, " The roots:"); Roots.roots_to_r8poly(nroot, roots, ref nc, ref c); typeMethods.r8poly_print(nc, c, " The polynomial:"); nroot = 3; roots[0] = 3.0; roots[1] = 1.0; roots[2] = 2.0; typeMethods.r8vec_print(nroot, roots, " The roots:"); Roots.roots_to_r8poly(nroot, roots, ref nc, ref c); typeMethods.r8poly_print(nc, c, " The polynomial:"); nroot = 4; roots[0] = 3.0; roots[1] = 1.0; roots[2] = 2.0; roots[3] = 4.0; typeMethods.r8vec_print(nroot, roots, " The roots:"); Roots.roots_to_r8poly(nroot, roots, ref nc, ref c); typeMethods.r8poly_print(nc, c, " The polynomial:"); }