示例#1
0
        /// <summary>
        /// The entry point of the program, where the program control starts and ends.
        /// </summary>
        public static void Main()
        {
            Console.WriteLine("Find the value of x1 x2 x3 of the equation");

            Double[,] linearEquation = new Double[, ] {
                { 1, 2, 1, 4 },
                { 3, -4, -2, 2 },
                { 5, 3, 5, 1 }
            };


            Double[][] matrix = new Double[][] {
                new Double[] { 1, 2, 1 },
                new Double[]  { 3, -4, -2 },
                new Double[] { 5, 3, 5 }
            };

            DisplayMatrix(linearEquation);

            Double[] bee   = { 4, 2, -1 };
            Double[] guess = { 1, 1, 1 };

            Console.WriteLine("Enter the initial guess");

            for (int i = 0; i < bee.Length; i++)
            {
                Console.Write(" A{0}: ", i + 1);
                guess[i] = Convert.ToDouble(Console.ReadLine());
            }

            GuassSeidel guass = new GuassSeidel(matrix, bee, guess);
        }
示例#2
0
        public static void Main()
        {
            Double[,] linearEquation = new Double[, ] {
                { 25, 5, 1, 106.8 },
                { 64, 8, 1, 177.2 },
                { 144, 12, 1, 292.2 }
            };


            Double[][] matrix = new Double[][] {
                new Double[] { 25, 5, 1, 106.8 },
                new Double[]  { 64, 8, 1, 177.2 },
                new Double[] { 144, 12, 1, 292.2 }
            };

            DisplayMatrix(linearEquation);

            Double[] bee   = { 106.8, 177.2, 292.2 };
            Double[] guess = { 1, 1, 1 };

            Console.WriteLine("Enter the initial guess");

            for (int i = 0; i < bee.Length; i++)
            {
                Console.Write(" A{0}: ", i + 1);
                guess[i] = Convert.ToDouble(Console.ReadLine());
            }

            GuassSeidel guass = new GuassSeidel(matrix, bee, guess);
        }