コード例 #1
0
    private static void hermite_polynomial_test14()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    HERMITE_POLYNOMIAL_TEST14 tests H_POLYNOMIAL_COEFFICIENTS.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    11 March 2012
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        double[] c;
        int      i;
        int      j;
        int      n = 10;

        Console.WriteLine("");
        Console.WriteLine("HERMITE_POLYNOMIAL_TEST14");
        Console.WriteLine("  H_POLYNOMIAL_COEFFICIENTS determines physicist's Hermite polynomial coefficients.");

        c = Hermite.h_polynomial_coefficients(n);

        for (i = 0; i <= n; i++)
        {
            Console.WriteLine("");
            Console.WriteLine("  H(" + i + ",x) =");
            Console.WriteLine("");
            for (j = i; 0 <= j; j--)
            {
                switch (c[i + j * (n + 1)])
                {
                case 0.0:
                    break;

                default:
                    switch (j)
                    {
                    case 0:
                        Console.WriteLine(c[i + j * (n + 1)].ToString().PadLeft(14) + "");
                        ;
                        break;

                    case 1:
                        Console.WriteLine(c[i + j * (n + 1)].ToString().PadLeft(14) + " * x");
                        break;

                    default:
                        Console.WriteLine(c[i + j * (n + 1)].ToString().PadLeft(14) + " * x^" + j + "");
                        break;
                    }

                    break;
                }
            }
        }
    }