Beispiel #1
0
    private static void test02()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    TEST02 tests DIFFER_INVERSE.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    03 November 2013
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int       n;
        const int N_MAX = 8;

        Console.WriteLine("");
        Console.WriteLine("TEST02");
        Console.WriteLine("  DIFFER_INVERSE returns the inverse of a DIFFER matrix;");
        Console.WriteLine("");
        Console.WriteLine("   N    Inverse error");

        int seed = 123456789;

        for (n = 2; n <= N_MAX; n++)
        {
            Console.WriteLine("");

            int test;
            for (test = 1; test <= 5; test++)
            {
                double[] x   = UniformRNG.r8vec_uniform_01_new(n, ref seed);
                double[] a   = Differ.differ_matrix(n, x);
                double[] b   = Differ.differ_inverse(n, x);
                double   err = Helpers.inverse_error(n, a, b);
                Console.WriteLine("  " + n.ToString().PadLeft(2)
                                  + "  " + err.ToString(CultureInfo.InvariantCulture).PadLeft(14) + "");
            }
        }
    }