Example #1
0
    public static void p_polynomial_prime2_test()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    P_POLYNOMIAL_PRIME2_TEST tests P_POLYNOMIAL_PRIME2.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    04 May 2013
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int i;

        Console.WriteLine("");
        Console.WriteLine("P_POLYNOMIAL_PRIME2_TEST:");
        Console.WriteLine("  P_POLYNOMIAL_PRIME2 evaluates the second derivative of the");
        Console.WriteLine("  Legendre polynomial P(n,x).");
        Console.WriteLine("");
        Console.WriteLine("                        Computed");
        Console.WriteLine("     N        X           P\"(N,X)");
        Console.WriteLine("");

        const int    m = 11;
        const double a = -1.0;
        const double b = +1.0;

        double[] x = typeMethods.r8vec_linspace_new(m, a, b);

        const int n = 5;

        double[] vpp = Legendre.p_polynomial_prime2(m, n, x);

        for (i = 0; i < m; i++)
        {
            Console.WriteLine("");
            int j;
            for (j = 0; j <= n; j++)
            {
                Console.WriteLine("  " + j.ToString(CultureInfo.InvariantCulture).PadLeft(4)
                                  + "  " + x[i].ToString(CultureInfo.InvariantCulture).PadLeft(12)
                                  + "  " + vpp[i + j * m].ToString("0.################").PadLeft(24) + "");
            }
        }
    }