Beispiel #1
0
    public static void test46()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    TEST46 tests TORUS_5S2, TORUS_6S2 and TORUS_14S.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    03 April 2008
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int    i;
        string name = "";

        const double r1 = 0.5;
        const double r2 = 1.0;

        Console.WriteLine("");
        Console.WriteLine("TEST46");
        Console.WriteLine("  For the interior of a torus,");
        Console.WriteLine("  TORUS_5S2,");
        Console.WriteLine("  TORUS_6S2, and");
        Console.WriteLine("  TORUS_5S2 approximate integrals.");
        Console.WriteLine("");
        Console.WriteLine("  Inner radius = " + r1 + "");
        Console.WriteLine("  Outer radius = " + r2 + "");
        Console.WriteLine("  Volume = " + Torus.torus_volume_3d(r1, r2) + "");
        Console.WriteLine("");
        Console.WriteLine("    Rule:        #5S2          #6S2          #14S");
        Console.WriteLine("    F(X)");
        Console.WriteLine("");

        int num = functions.function_3d_num();

        for (i = 1; i <= num; i++)
        {
            int function_3d_index = i;
            functions.function_3d_name(function_3d_index, ref name);

            double result1 = Torus.torus_5s2(function_3d_index, functions.function_3d, r1, r2);
            double result2 = Torus.torus_6s2(function_3d_index, functions.function_3d, r1, r2);
            double result3 = Torus.torus_14s(function_3d_index, functions.function_3d, r1, r2);

            Console.WriteLine("  " + name
                              + "  " + result1.ToString(CultureInfo.InvariantCulture).PadLeft(14)
                              + "  " + result2.ToString(CultureInfo.InvariantCulture).PadLeft(14)
                              + "  " + result3.ToString(CultureInfo.InvariantCulture).PadLeft(14) + "");
        }
    }