示例#1
0
    public static void lp_coefficients_test()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    LP_COEFFICIENTS_TEST tests LP_COEFFICIENTS.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    30 October 2014
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        const int m = 1;
        int       n;
        const int N_MAX = 10;
        int       o     = 0;

        Console.WriteLine("");
        Console.WriteLine("LP_COEFFICIENTS_TEST");
        Console.WriteLine("  LP_COEFFICIENTS: coefficients of Legendre polynomial P(n,x).");
        Console.WriteLine("");

        for (n = 0; n <= N_MAX; n++)
        {
            double[] c = new double[n + 1];
            int[]    f = new int[n + 1];

            Legendre.lp_coefficients(n, ref o, ref c, ref f);

            int[] e = new int[o];
            int   i;
            for (i = 0; i < o; i++)
            {
                e[i] = f[i] + 1;
            }

            string label = "  P(" + n + ",x) = ";
            Polynomial.polynomial_print(m, o, c, e, label);
        }
    }