static void Main(string[] args)
        {
            double[][] m =  {
                                new double[] {   -3, 4,  1,  4 },
                                new double[] {    0, 1, -3,  2 },
                                new double[] {    4, 0, -2, -3 },
                                new double[] { 1000, 3,  1, -5 }
                            };
            double[] b = { -1, -1, 4, -2 };

            LinearSystem ls = new LinearSystem(m, b);

            Console.WriteLine("Initial linear system:");
            Console.WriteLine();

            Console.WriteLine(ls);

            double[] solution = ls.Solve();
            double[] error = ls.CalculateError(solution);

            Console.WriteLine("Solution:");
            Print(solution);
            Console.WriteLine("Error:");
            Print(error);

            Console.ReadKey();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            double[][] m =
            {
                new double[] {   -3, 4,  1,  4 },
                new double[] {    0, 1, -3,  2 },
                new double[] {    4, 0, -2, -3 },
                new double[] { 1000, 3,  1, -5 }
            };
            double[] b = { -1, -1, 4, -2 };

            LinearSystem ls = new LinearSystem(m, b);

            Console.WriteLine("Initial linear system:");
            Console.WriteLine();

            Console.WriteLine(ls);

            double[] solution = ls.Solve();
            double[] error    = ls.CalculateError(solution);

            Console.WriteLine("Solution:");
            Print(solution);
            Console.WriteLine("Error:");
            Print(error);

            Console.ReadKey();
        }