Example #1
0
    private static void hpp_test02()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    HPP_TEST02 tests HEP_VALUE.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    22 October 2014
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        double e;
        int    n;
        int    n_data;
        int    o = 0;
        double x = 0;

        double[] xvec = new double[1];
        double   fx1  = 0;

        double[] fx2;

        n = 1;

        Console.WriteLine("");
        Console.WriteLine("HPP_TEST02:");
        Console.WriteLine("  HEP_VALUES stores values of");
        Console.WriteLine("  the Hermite polynomial He(o,x).");
        Console.WriteLine("  HEP_VALUE evaluates a Hermite polynomial.");
        Console.WriteLine("");
        Console.WriteLine("                        Tabulated                 Computed");
        Console.WriteLine("     O        X          He(O,X)                   He(O,X)" +
                          "                   Error");
        Console.WriteLine("");

        n_data = 0;

        for (;;)
        {
            Burkardt.Values.Hermite.hep_values(ref n_data, ref o, ref x, ref fx1);

            if (n_data == 0)
            {
                break;
            }

            xvec[0] = x;

            fx2 = Hermite.hep_value(n, o, ref xvec);

            e = fx1 - fx2[0];

            Console.WriteLine(o.ToString().PadLeft(6) + "  "
                              + x.ToString().PadLeft(12) + "  "
                              + fx1.ToString().PadLeft(24) + "  "
                              + fx2[0].ToString().PadLeft(24) + "  "
                              + e.ToString().PadLeft(8) + "");
        }
    }