Exemplo n.º 1
0
    public static void p_polynomial_prime_test()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    P_POLYNOMIAL_PRIME_TEST tests P_POLYNOMIAL_PRIME.
    //
    //  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_PRIME_TEST:");
        Console.WriteLine("  P_POLYNOMIAL_PRIME evaluates the 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[] vp = Legendre.p_polynomial_prime(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)
                                  + "  " + vp[i + j * m].ToString("0.################").PadLeft(24) + "");
            }
        }
    }