Ejemplo n.º 1
0
    public static void bell_test( )

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    BELL_TEST tests BELL.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    07 November 2012
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int c = 0;
        int n = 0;

        Console.WriteLine("");
        Console.WriteLine("BELL_TEST");
        Console.WriteLine("  BELL computes Bell numbers.");
        Console.WriteLine("");
        Console.WriteLine("  N  exact C(I)  computed C(I)");
        Console.WriteLine("");

        int n_data = 0;

        for ( ; ;)
        {
            Bell.bell_values(ref n_data, ref n, ref c);

            if (n_data == 0)
            {
                break;
            }

            int[] c2 = new int[n + 1];

            Bell.bell(n, ref c2);

            Console.WriteLine("  "
                              + n.ToString().PadLeft(4) + "  "
                              + c.ToString().PadLeft(8) + "  "
                              + c2[n].ToString().PadLeft(8) + "");
        }
    }
Ejemplo n.º 2
0
    public static void bell_values_test()
    //****************************************************************************80
    //
    //  Purpose:
    //
    //    BELL_VALUES_TEST tests BELL_VALUES.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    07 February 2007
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int c = 0;
        int n = 0;

        Console.WriteLine("");
        Console.WriteLine("BELL_VALUES_TEST:");
        Console.WriteLine("  BELL_VALUES returns values of ");
        Console.WriteLine("  the Bell numbers.");
        Console.WriteLine("");
        Console.WriteLine("     N        BELL(N)");
        Console.WriteLine("");
        int n_data = 0;

        for (;;)
        {
            Bell.bell_values(ref n_data, ref n, ref c);
            if (n_data == 0)
            {
                break;
            }

            Console.WriteLine("  "
                              + n.ToString().PadLeft(6) + "  "
                              + c.ToString().PadLeft(10) + "");
        }
    }