コード例 #1
0
    public static void p_polynomial_zeros_test()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    P_POLYNOMIAL_ZEROS_TEST tests P_POLYNOMIAL_ZEROS.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    14 March 2012
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int degree;

        Console.WriteLine("");
        Console.WriteLine("P_POLYNOMIAL_ZEROS_TEST:");
        Console.WriteLine("  P_POLYNOMIAL_ZEROS computes the zeros of P(n,x)");
        Console.WriteLine("  Check by calling P_POLYNOMIAL_VALUE there.");

        for (degree = 1; degree <= 5; degree++)
        {
            double[] z     = Legendre.p_polynomial_zeros(degree);
            string   title = "  Computed zeros for P(" + degree + ",z):";
            typeMethods.r8vec_print(degree, z, title);

            double[] hz = Legendre.p_polynomial_value(degree, degree, z);
            title = "  Evaluate P(" + degree + ",z):";
            typeMethods.r8vec_print(degree, hz, title, +degree * degree);
        }
    }