![]() |
|
|
Регистрация Восстановить пароль |
Регистрация | Задать вопрос |
Заплачу за решение |
Новые сообщения |
Сообщения за день |
Расширенный поиск |
Правила |
Всё прочитано |
![]() |
|
Опции темы | Поиск в этой теме |
![]() |
#1 |
Регистрация: 22.12.2011
Сообщений: 5
|
![]()
//////////////////////////////////////////////////////////////////////////////
// // Solving system of linear equations (orthogonalization method) // (c) Johna Smith, 1996 // // Method description: // Given system of linear equations: // a11 x1 + a12 x2 + ... + a1n xn + a(1n+1) = 0 // a21 x1 + a22 x2 + ... + a2n xn + a(2n+1) = 0 // // an1 x1 + an2 x2 + ... + ann xn + a(nn+1) = 0 // // Left part of each equation is a result of scalar multiplication of // two vectors: ai=(ai1,ai2,...,ain,a(in+1)) and x=(x1,x2,..,xn,1) // So to solve this system we need only to build vector x which will be // orthogonal to each of ai vectors. // n+1 // Let u1=a1, b1=u1/sqrt(SUM u(1j)^2) // j=1 // // Other ui we can get from the following iterative formula: // k // u(k+1)=u(k+1)-SUM {u(k+1), bj}bj, where {..} means scalar multiplication // j=1 // n+1 // b(k+1)=u(k+1)/sqrt(SUM u(k+1,j)^2) // j=1 // And finally we can obtain roots of this system from this formula: // // xi=b(n+1,i)/b(n+1n+1) // ////////////////////////////////////////////////////////////////////////////// Код:
int n, m, jm, sm; // обозначаем переменные Console.Write("n = "); n = Convert.ToInt32(Console.ReadLine()) ; Console.Write("m = "); m = Convert.ToInt32(Console.ReadLine()) ; int[,] kk = new int[n, m]; int i, j; for (i = 0; i < n; i++) { for (j = 0; j < m; j++) { Console.Write("kk [{0},{1}]=", i, j); kk[i, j] = Convert.ToInt32(Console.ReadLine()) ; } } //вывод элементов System.Console.WriteLine("Out Array");//текст в консоли for (i = 0; i < n; i++) { for (j = 0; j < m; j++) { System.Console.Write(kk[i, j] + "\t"); } System.Console.WriteLine(); } |
![]() |
![]() |
![]() |
![]() |
||||
Тема | Автор | Раздел | Ответов | Последнее сообщение |
решение слу методом квадратного корня | dmitrialenitchev | Общие вопросы C/C++ | 1 | 03.10.2011 00:08 |
Метод скорейшего спуска решение СЛУ | Yulian@ | Помощь студентам | 11 | 31.03.2011 11:07 |
Перевести код из C++ в C# | Dj_SheLL | Помощь студентам | 0 | 22.03.2011 23:18 |
Конкурс для программистов - Решение целочисленной СЛУ | Zealint | Свободное общение | 1 | 11.02.2011 17:17 |
Решение СЛУ методом Гаусса-Джордана | Жизнь | Помощь студентам | 2 | 05.10.2008 16:23 |