Esempio n. 1
0
    private static void chebyquad_test()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    CHEBYQUAD_TEST calls PRAXIS for the Chebyquad function.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    04 August 2016
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int       i;
        const int n = 8;

        double[] x = new double[8];

        Console.WriteLine("");
        Console.WriteLine("CHEBYQUAD_TEST");
        Console.WriteLine("  The Chebyquad function.");

        const double t0   = 0.00001;
        const double h0   = 0.1;
        const int    prin = 0;

        for (i = 0; i < n; i++)
        {
            x[i] = (i + 1) / (double)(n + 1);
        }

        typeMethods.r8vec_print(n, x, "  Initial point:");

        Console.WriteLine("  Function value = " + chebyquad_f(x, n) + "");

        PRAXIS.praxis(t0, h0, n, prin, ref x, chebyquad_f);

        typeMethods.r8vec_print(n, x, "  Computed minimizer:");

        Console.WriteLine("  Function value = " + chebyquad_f(x, n) + "");
    }
Esempio n. 2
0
    private static void beale_test()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    BEALE_TEST calls PRAXIS for the Beale function.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    04 August 2016
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        const int n = 2;

        double[] x = { 0.1, 0.1 };

        Console.WriteLine("");
        Console.WriteLine("BEALE_TEST");
        Console.WriteLine("  The Beale function.");

        const double t0   = 0.00001;
        const double h0   = 0.25;
        const int    prin = 0;

        typeMethods.r8vec_print(n, x, "  Initial point:");

        Console.WriteLine("  Function value = " + beale_f(x, n) + "");

        PRAXIS.praxis(t0, h0, n, prin, ref x, beale_f);

        typeMethods.r8vec_print(n, x, "  Computed minimizer:");

        Console.WriteLine("  Function value = " + beale_f(x, n) + "");
    }
Esempio n. 3
0
    private static void helix_test()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    HELIX_TEST calls PRAXIS for the Fletcher-Powell Helix function.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    04 August 2016
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        const int n = 3;

        double[] x = { -1.0, 0.0, 0.0 };

        Console.WriteLine("");
        Console.WriteLine("HELIX_TEST");
        Console.WriteLine("  The Fletcher-Powell Helix function.");

        const double t0   = 0.00001;
        const double h0   = 1.0;
        const int    prin = 0;

        typeMethods.r8vec_print(n, x, "  Initial point:");

        Console.WriteLine("  Function value = " + helix_f(x, n) + "");

        PRAXIS.praxis(t0, h0, n, prin, ref x, helix_f);

        typeMethods.r8vec_print(n, x, "  Computed minimizer:");

        Console.WriteLine("  Function value = " + helix_f(x, n) + "");
    }