Пример #1
0
    public static void test45()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    TEST45 tests TORUS_1.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    03 April 2008
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int    i;
        int    j;
        int    j2;
        string name = "";

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

        Console.WriteLine("");
        Console.WriteLine("TEST45");
        Console.WriteLine("  TORUS_1 approximates integrals on a torus.");
        Console.WriteLine("");
        Console.WriteLine("  The order N will be varied.");
        Console.WriteLine("");
        Console.WriteLine("  Inner radius = " + r1 + "");
        Console.WriteLine("  Outer radius = " + r2 + "");
        Console.WriteLine("  Area = " + Torus.torus_area_3d(r1, r2) + "");
        Console.WriteLine("");
        string cout = "  " + "  F(X)  ";

        for (j = 1; j <= 5; j++)
        {
            j2    = 2 * (j - 1);
            cout += ((int)Math.Pow(2, j2)).ToString().PadLeft(14);
        }

        Console.WriteLine(cout);
        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);

            cout = "  " + name;

            for (j = 1; j <= 5; j++)
            {
                j2 = 2 * (j - 1);
                int    n      = (int)Math.Pow(2, j2);
                double result = Torus.torus_1(function_3d_index, functions.function_3d, r1, r2, n);
                cout += result.ToString(CultureInfo.InvariantCulture).PadLeft(14);
            }

            Console.WriteLine(cout);
        }
    }