Esempio n. 1
0
        public static void allIteration(double a, double b)
        {
            DichometricsMethod  DichometricsMethod  = new DichometricsMethod();
            GoldenSectionMethod GoldenSectionMethod = new GoldenSectionMethod();
            FibonacciMethod     FibonacciMethod     = new FibonacciMethod();
            ParabolMethods      ParabolMethods      = new ParabolMethods();

            double Eps = 1E-1;

            Console.WriteLine("{0,20} {1,13} {2,13} {3,13} {4,13} {5,12} {6,14} {7,12" +
                              "}", "Name Method | Eps", 1E-1, 1E-2, 1E-3, 1E-4, 1E-5, 1E-6, 1E-7);

            Console.Write("{0,20}", "Dichometrics      ");
            for (int i = 0; i < 7; i++)
            {
                DichometricsMethod.Do(a, b, Eps);
                Console.Write("{0,10}({1,2})", DichometricsMethod.getNumberOfIterationsObjectiveFunction(), DichometricsMethod.NumberOfIteration);
                Eps /= 1E+1;
            }
            Console.WriteLine();

            Eps = 1E-1;
            Console.Write("{0,20}", "Golden Section      ");
            for (int i = 0; i < 7; i++)
            {
                GoldenSectionMethod.Do(a, b, Eps);
                Console.Write("{0,10}({1,2})", GoldenSectionMethod.getNumberOfIterationsObjectiveFunction(), GoldenSectionMethod.NumberOfIteration);
                Eps /= 1E+1;
            }
            Console.WriteLine();

            Eps = 1E-1;
            Console.Write("{0,14}      ", "Fibonacci");
            for (int i = 0; i < 7; i++)
            {
                FibonacciMethod.Do(a, b, Eps);
                Console.Write("{0,10}({1,2})", FibonacciMethod.getNumberOfIterationsObjectiveFunction(), FibonacciMethod.NumberOfIteration);
                Eps /= 1E+1;
            }
            Console.WriteLine();

            Eps = 1E-1;
            Console.Write("{0,20}", "Parabol      ");
            for (int i = 0; i < 7; i++)
            {
                ParabolMethods.Do(a, b, Eps);
                Console.Write("{0,10}({1,2})", ParabolMethods.getNumberOfIterationsObjectiveFunction(), ParabolMethods.NumberOfIteration);
                Eps /= 1E+1;
            }
            Console.WriteLine();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            /*lab1
             * var l = new Lagrange(4, "../../../LAB1/values.txt");
             * Console.WriteLine(l.Calculate());
             */

            //lab2
            //Console.WriteLine("Value: ");
            //var value = float.Parse(Console.ReadLine());
            //var n = new Newton(value, "../../../LAB2/values.txt");
            //Console.WriteLine(n.Calculate());

            ////lab3

            //Console.WriteLine("Podaj poczatek przedzialu calkowania");
            //float xp = float.Parse(Console.ReadLine());

            //Console.WriteLine("Podaj koniec przedzialu calkowania");
            //float xk = float.Parse(Console.ReadLine());

            //Console.WriteLine("Podaj dokladnosc calkowania");
            // int n = int.Parse(Console.ReadLine());

            //var v = new IntegralMethod(xp, xk, n);

            //Console.WriteLine("Wartosc calki wynosi w przyblizeniu: ");

            //Console.WriteLine("Dla metody prostokatow: " + v.methodRectangle());

            //Console.WriteLine("Dla metody trapezow: " + v.methodTrapezoidal());

            //lab5
            // BisectionMethod.Calculate(-2,1);
            //NewtonRaphsonMethod.Calculate(1, 64);

            //lab6
            //Console.WriteLine("Figura field : "+ Gausse.Calculate());

            //lab7
            Console.WriteLine("Figura field : " + GoldenSectionMethod.Calculate(1, 3, 4));
        }
Esempio n. 3
0
        public static void showTable(double a, double b, double Eps)
        {
            DichometricsMethod  DichometricsMethod  = new DichometricsMethod();
            GoldenSectionMethod GoldenSectionMethod = new GoldenSectionMethod();
            FibonacciMethod     FibonacciMethod     = new FibonacciMethod();
            ParabolMethods      ParabolMethods      = new ParabolMethods();


            Console.WriteLine("Dichometrics Method: ");
            DichometricsMethod.Do(a, b, Eps);
            Console.WriteLine("Number Of Iterations: " + DichometricsMethod.getNumberOfIterationsObjectiveFunction());
            DichometricsMethod.ShowTable(Eps);

            Console.WriteLine("GoldenSection Method: ");
            GoldenSectionMethod.Do(a, b, Eps);
            Console.WriteLine("Number Of Iterations: " + GoldenSectionMethod.getNumberOfIterationsObjectiveFunction());
            GoldenSectionMethod.ShowTable(Eps);

            Console.WriteLine("Fibonacci Method: ");
            FibonacciMethod.Do(a, b, Eps);
            Console.WriteLine("Number Of Iterations: " + FibonacciMethod.getNumberOfIterationsObjectiveFunction());
            FibonacciMethod.ShowTable(Eps);
        }