//Лаб 9 public static void MatrixOperationWork(double[,] a, double[,] b) { double[,] c = MatrixOperations.Multiplication(a, a); double[,] d = MatrixOperations.Multiplication(b, -1); c = MatrixOperations.Addition(c, d); c = MatrixOperations.Multiplication(c, a); d = MatrixOperations.Addition(d, b); double[,] e = MatrixOperations.Addition(b, a); e = MatrixOperations.Multiplication(e, 2); e = MatrixOperations.Multiplication(e, b); e = MatrixOperations.Multiplication(e, -1); c = MatrixOperations.Addition(c, e); Console.WriteLine("Решение задачи с матрицами:"); for (int i = 0; i < a.GetLength(0); i++) { for (int j = 0; j < a.GetLength(1); j++) { Console.Write("{0,6}", c[i, j]); } Console.WriteLine(); } }
public static void MaxValue(double[,] A, double[] X, double epsilon) { double k = 1 / Norma2(X); X = Multiplication(k, X); double[] y1 = MatrixOperations.Multiplication(A, X); double lambda1 = Multiplication(X, y1); double[] x1 = Multiplication(1 / Norma2(y1), y1); double[] y2 = MatrixOperations.Multiplication(A, x1); double lambda2 = Multiplication(x1, y2); double[] x2 = Multiplication(1 / Norma2(y2), y2); while (lambda2 - lambda1 > epsilon) { y1 = y2; lambda1 = lambda2; x1 = x2; y2 = MatrixOperations.Multiplication(A, x1); lambda2 = Multiplication(x1, y2); x2 = Multiplication(1 / Norma2(y2), y2); } Console.Write("Собственное число: {0:F6}\nНорма вектора: {1}\nВектор: ", lambda2, Norma2(x2)); for (int i = 0; i < x2.Length; i++) { Console.Write("{0} ", x2[i]); } }