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

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    GEN_HERMITE_POLY_TEST tests GEN_HERMITE_POLY.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    10 February 2015
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        const int N      = 10;
        const int N_TEST = 6;

        double[] c = new double[N + 1];
        int      i;

        double[] mu_test = { 0.0, 0.0, 0.1, 0.1, 0.5, 1.0 };
        double[] x_test  = { 0.0, 1.0, 0.0, 0.5, 0.5, 0.5 };

        Console.WriteLine("");
        Console.WriteLine("GEN_HERMITE_POLY_TEST");
        Console.WriteLine("  GEN_HERMITE_POLY evaluates the generalized Hermite");
        Console.WriteLine("  polynomial.");

        for (i = 0; i < N_TEST; i++)
        {
            double x  = x_test[i];
            double mu = mu_test[i];

            Console.WriteLine("");
            Console.WriteLine("  Table of H(N,MU)(X) for");
            Console.WriteLine("");
            Console.WriteLine("    N(max) = " + N + "");
            Console.WriteLine("    MU =     " + mu + "");
            Console.WriteLine("    X =      " + x + "");
            Console.WriteLine("");

            Hermite.gen_hermite_poly(N, x, mu, ref c);

            int j;
            for (j = 0; j <= N; j++)
            {
                Console.WriteLine("  "
                                  + j.ToString(CultureInfo.InvariantCulture).PadLeft(6) + "  "
                                  + c[j].ToString(CultureInfo.InvariantCulture).PadLeft(14) + "");
            }
        }
    }