1-mavzu: Chiziqli algebraik tenglamalar sistemasini yechishning Gauss usuli
Download 0.62 Mb. Pdf ko'rish
|
chiziqli algebraik tenglamalar sistemasini yechishning gauss usuli
- Bu sahifa navigatsiya:
- Bajarish.
1-mavzu: Chiziqli algebraik tenglamalar sistemasini yechishning Gauss usuli Nazariy va tadbiqiy matematikaning ko‘pgina masalalari birinchi darajali chiziqli tenglamalar sistemasini yechishga olib kelinadi. Masalan, funksiyaning n-ta nuqtada berilgan qiymatlari yordamida n-tartibli ko‘phad bilan interpolyatsiyalash yoki funksiyani o‘rta kvadratlar usuli yordamida yaqinlashtirish masalalari birinchi darajali chiziqli tenglamalar sistemasini yechishga keltiriladi. Birinchi darajali chiziqli tenglamalar sistemasini hosil qilishning manbai uzluksiz funksional tenglamalarni chekli ayirmali tenglamalar bilan yaqinlashtirishdir. Birinchi darajali chiziqli tenglamalar sistemasini yechish asosan ikki usulga, ya’ni aniq va iteratsion usullarga bo‘linadi. Aniq usul deganda chekli miqdordagi arifmetik amallarni aniq bajarish natijasida masalaning aniq yechimini topish tushuniladi. Iteratsion usullarda chiziqli tenglamalar sistemasining yechimi ketma- ket yaqinlashishlarning limiti sifatida topiladi. Chiziqli tenglamalar sistemasini yechishning noma’lumlarni ketma-ket yo‘qotish orqali aniqlash usuli, ya’ni Gauss usulini ko‘rib chiqamiz. Bu usul bir necha hisoblash yo‘llariga ega. Shulardan biri Gaussning kompleks yo‘lidir. Ushbu sistema berilgan bo‘lsin = + + + = + + + = + + + + + + . , ...
, ........
.......... .......... .......... .......... , ,
, , ... 1 2 2 1 1 1 2 2 2 22 1 21 1 1 1 2 12 1 11 n n n nn n n n n n n n n a x а х а х а a x а х а х а a x а х а х а (1)
Faraz qilaylik, a 11 ≠0 (etakchi element) bo‘lsin, aks holda tenglamalarning o‘rinlarini almashtirib, 1
oldidagi koeffisienti noldan farqli bo‘lgan tenglamani birinchi o‘ringa ko‘chiramiz. Sistemadagi birinchi tenglamaning barcha koeffisientlarini a 11 ga bo‘lib, ) 1 ( 1 , 1 ) 1 ( 1 2 ) 1 ( 12 1 ... + = + + +
n n b x b x b х (2) ni hosil qilamiz, bu yerda
, ) 1 ( 12 11 12 b a a = . . . , , ) 1 ( 1 11 1 n n b a a = ) 1 ( 1 , 1 11 1 , 1 + + = n n b a a
yoki qisqacha ( ) . 2 11 1 ) 1 ( 1 ≥ = j a a b j j
(2) tenglamadan foydalanib, (1) sistemaning qolgan tenglamalarida x 1 ni
yo‘qotish mumkin. Buning uchun (2) tenglamani ketma-ket a 21 , a 31 , … larga ko‘paytirib, mos ravishda sistemaning ikkinchi, uchinchi va h.k. tenglamalaridan ayiramiz. Natijada, quyidagi sistema hosil bo‘ladi.
= + + = + + + + , ...
. .......... .......... .......... .......... , ... ) 1 ( 1 , ) 1 ( 2 ) 1 ( 2 ) 1 ( 1 , 2 ) 1 ( 2 2 ) 1 ( 22 n n n nn n n n n a x a x a a x a x a
(3)
) 1 ( ij a koeffisientlar ) 1
1 1 ) 1 (
i ij ij b a a a − = , ( ) 2 , ≥ j i
formula yordamida hisoblanadi. Endi (3) sistema ustida ham shunga o‘xshash almashtirishlar bajaramiz. Buning uchun (3) sistemadagi birinchi tenglamaning barcha koeffisientlarini yetakchi element 0 ) 1 ( 22 ≠ a ga bo‘lib, ) 2
1 , 2 ) 2 ( 2 3 ) 2 ( 23 2 ...
+ = + + +
n n b x b x b x (4) ni hosil qilamiz, bu yerda ) 1 ( 22 ) 1 ( 2 ) 2 ( 2 a a b j j = ) 3 ( ≥ j
(4) tenglama yordamida (3) sistemaning keyingi tenglamalarida yuqoridagidek x 2 ni yo‘qotib,
= + + = + + + + ) 2 ( 1 , ) 2 ( 3 ) 2 ( 3 ) 2 ( 1 , 3 ) 2 ( 3 3 ) 2 ( 33 ... , .......... .......... .......... .......... , ... n n n nn n n n n a x a x a a x a x a
sistemaga kelamiz, bu yerda , ) 2 ( 2 ) 1 ( 2 ) 1 ( ) 2 ( j i ij ij b a a a − = ( ) 2 , ≥
i
Noma’lumlarni yo‘qotish jarayoni davom ettirilib, bu jarayonni m–qadamgacha bajarish mumkin deb faraz qilamiz va m – qadamda quyidagi sistemaga ega bo‘lamiz. = + + = + + = + + + + + + + + + + + + + + . ... , ......
.......... .......... .......... .......... , ...
, ...
) ( 1 , ) ( 1 ) ( 1 , ) ( 1 , ) ( , 1 1 ) ( 1 , 1 ) ( 1 , ) ( 1 ) ( 1 , m n n n m nn m m m n m n m n m n m m m m m m n m n m mn m m m m m a x a x a a x a x a b x b x b x
(5) bu yerda , )
) ( ) ( m mm m mj m mj a a b = ) ( ) 1 ( ) 1 ( ) ( m mj m im m ij m ij b a a a − − − = ( ) 1 , + ≥ m j i .
Faraz qilaylik, m mumkin bo‘lgan oxirgi qadamning nomeri bo‘lsin. Ikki hol bo‘lishi mumkin: m=n yoki m matritsali va (1) sistemaga ekvivalent bo‘lgan quyidagi = = + + + = + + + + + + + ) ( 1 , ) 2 ( 1 , 2 ) 2 ( 2 3 ) 2 ( 23 2 ) 1 ( 1 , 1 ) 1 ( 1 3 ) 1 ( 13 2 ) 1 ( 12 1 , .. .......... .......... .......... .......... .......... , ...
, ...
n n n n n n n n n n b x b x b x b x b x b x b x b x (6) sistemaga ega bo‘lamiz. Oxirgi sistemadan ketma-ket 1 1 ..., , , x x x n n − larni topish mumkin − − = − = = + − − − + − − − . ... .. .......... .......... .......... .......... ) 1 ( , 1 2 ) 1 ( 1 , 1 1 ) 1 ( , 1 ) 1 ( 1 , 1 1 ) ( 1 , n n n n n n n n n n n n n n n x b x b x x b b x b x (7) (6) uchburchak sistemasining koeffisientlarini topish Gauss usulining
Gauss usuli bilan quyidagi sistema yechilsin. = + + + = + − + = − − + = − + − , 2 , 2 3 2 4 , 4 2 2 3 , 5 4 2 3 2 4 3 2 1 4 3 2 1 4 3 2 1 4 3 2 1 x x x x x x x x x x x x x x x x
) 11
) 10 ( ) 9 ( ) 8 (
(8) tenglamadan x 1 ni topamiz , 2 2 3 2 5 , 4 2 3 5 2 , 5 4 2 3 2 4 3 2 1 4 3 2 1 4 3 2 1 x x x x x x x x x x x x + − + = + − + = = − + −
(12) (12) tenglamani (9) tenglamadagi x 1 ni o‘rniga qo‘yamiz va uni ixchamlaymiz. . 7 8 10 11 , 8 4 4 2 12 6 9 15 , 4 2 2 . 6 3 2 9 2 15 , 4 2 2 2 2 3 2 5 3 , 4 2 2 3 4 3 2 4 3 2 4 3 2 4 3 2 4 3 2 4 3 2 4 3 2 4 3 2 1 − = + − = − − + + − + = − − + + − + = − − + + − + = − − +
x x x x x x x x x x x x x x x x x x x x x x x x
(12) tenglamani (10) tenglamadagi x 1 ni o‘rniga qo‘yamiz va uni ixchamlaymiz. . 8
7 8 , 2 3 2 8 4 6 10 , 2 3 2 2 2 3 2 5 4 , 2 3 2 4 3 3 2 4 3 2 4 3 2 4 3 2 4 3 2 4 3 2 1 − = + − = + − + + − + = + − + + − + = + − + x x x x x x x x x x x x x x x x x x x
(12) tenglamani (11) tenglamadagi x 1 ni o‘rniga qo‘yamiz va uni ixchamlaymiz.
Yuqoridagilardan quyidagi yangi tenglamalar sistemasini hosil qilamiz − = + − = + − − = + − = − + − ) 15 ( . 1 6 5 ) 14 ( , 8 9 7 8 ) 13 ( , 7 8 10 11 , 5 4 2 3 2 4 2 4 3 2 4 3 2 4 3 2 1 x x x x x x x x x x x x
(13) tenglamadan x 2 ni topamiz , 11
11 10 11 7 , 8 10 7 11 , 7 8 10 11 4 3 2 4 3 2 4 3 2
x x x x x x x x − + − = − + − = − = + −
(16) .
6 5 , 4 2 2 2 4 2 3 5 , 2 2 2 3 2 5 , 2 4 2 4 3 2 4 3 2 4 3 2 4 3 2 4 3 2 1 − = + = + + + + − + = + + + + − + = + + +
x x x x x x x x x x x x x x x x x (16) tenglamani (14) tenglamadagi 2
ixchamlaymiz , 32 35 3 , 88 99 77 64 80 56 , 8 9 7 11 64 11 80 11 56 , 8 9 7 11 8 11 10 11 7 8 , 8 9 7 8 4 3 4 3 4 3 4 3 4 3 4 3 4 3 4 3 2 − = + − = + − − + − − = + − − + − − = + − − + − − = + −
x x x x x x x x x x x x x x x x
(15) (16) tenglamani (15) tenglamadagi 2 x ni o‘rniga qo‘yamiz va uni ixchamlaymiz . 12 13 25 , 24 26 50 , 11 66 40 50 35 , 1 6 11 40 11 50 11 35 , 1 6 11 8 11 10 11 7 5 , 1 6 5 4 3 4 3 4 4 3 4 4 3 4 4 3 4 2 = + = + − = + − + − − = + − + − − = + − + − − = + x x x x x x x x x x x x x x x
Yuqoridagilardan qo‘yidagi yangi tenglamalar sistemasini hosil qilamiz = + − = + − = + − = − + − ) 18 ( . 12 13 25 ) 17 ( , 32 35 3 , 7 8 10 11 , 5 4 2 3 2 4 3 4 3 4 3 2 4 3 2 1 x x x x x x x x x x x
(17) tenglamadan 3 x ni topamiz . 3
3 32 , 35 32 3 , 32 35 3 4 3 4 3 4 3 x x x x x x − − = − − = − = +
(19) (19) tenglamani (18) tenglamadagi 3 x ni o‘rniga qo‘yamiz va uni ixchamlaymiz [ ] . 1 , 836 836
, 36 13 875 800
, 12 13 3 875
3 800
, 12 13 3 35 3 32 25 , 12 13 25 4 4 4 4 4 4 4 4 4 3 − = = − = + − − = + − − = + − − = + x x x x x x x x x x
(20) (20) tenglamaning qiymatini (19) tenglamadagi 4
3
topamiz. [ ]
1 , 1 3 35 3 32 3 35 3 32 3 4 3 = = + − = − − = x x x (21) (21) va (20) qiymatlarini (18) tenglamadagi 3
4
qo‘yib
2 x ni topamiz. , 1 11 11 11 8 11 10 11 7 11 8 11 10 11 7 4 3 2 = = + + − = − + − = x x x (22) [ ]
1 2 = x
(20), (21) va(22) larni qiymatlarini (12) tenglamadagi x 2 , x 3 va x 4 lar ni
o‘rniga qo‘yib x 1 ni topamiz. [ ]
1 , 1 3 4 3 5 , 1 5 , 2 2 1 1 2 3 2 5 2 2 3 2 5 1 4 3 2 1 = = − = − + = − − ⋅ + = + − + = x x x x x
Demak, topilgan ildizlar [ ] 1 1 = x , [ ] 1 2 = x , [ ] 1 3 = x , [ ] 1 4 − =
berilgan tenglamalar sistemasini to‘liq qanoatlantiradi.
Tenglamalar sistemasi qo‘lda yechilganda hisoblashlarni 1-jadvalda ko‘rsatilgan Gaussning kompakt sxemasi bo‘yicha olib borish ma’quldir.
Soddalik uchun jadvalda to‘rtta no’malumli to‘rtta tenglamalar sistemasini yechish sxemasi keltirilgan.
1 x 2
3
4
OZOD HADLAR ∑ SXEMA QISMLARI a 11 a 21 a 31 a 41 … 1 a 12 a 22 a 32 a 42 … b 12 (1) a 13 a 23 a 33 a 43 … b 13 (1) a 14 a 24 a 34 a 44 … b 14 (1) a 15 a 25 a 35 a 45 … b 15 (1) a 16 a 26 a 36 a 46 … b 16 (1) A a 22 (1) a 32 (1) a 42 (1) … a 23 (1) a 32 (1) a 43 (1) … a 24 (1) a 34 (1) a 44 (1) … a 25 (1) a 35 (1) a 45 (1) … a 25 (1) a 35 (1) a 45 (1) … A 1 1-jadval
1-jadvalda keltirilgan Gaussning kompakt sxemasi yordamida quyidagi tenglamalar sistemasi yechilsin: 2-misol. = + − − − = − + − − = − + − = − + + . 0 5 , 1 2 , 1 8 , 0 6 , 1 , 6 , 1 4 , 2 3 4 , 0 , 2 , 3 3 6 , 1 2 , 4 2 4 3 2 1 4 3 2 1 3 2 1 4 3 2 1 x x x x x x x x x x x x x x x
Sistemani yechish jarayoni 2-jadvalda keltirilgan. 2 - jadval 1 b 23 (2) b 24 (2) b 25 (2) b 25 (2) a 33 (2) a 43 (2) ... 1 a 34 (2) a 44 (2) … b 34 (3) a 35 (2) a 45 (2) … b 35 (3) a 36 (2) a 46 (2) … b 36 (3) A 2 a 44 (3) … 1 a 45 (3) … b 45 (4) a 46 (3) … b 46 (4) A 3 1 1 1 1 x 4 x 3 x 2 x 1 x 4 x 3 x 2 x 1
1
2 х
3 х
4 х
OZOD HADL AR
∑
SXEMA QISMLA RI
2 -0,4 1,6 1 … 1 4,2 3 -0,8 -2 … 2,1 1,6 -2,4 1 -1 … 0,8 -3 0 -1 1,5 … -1,5 3,2 -1,6 -1 0 … 1,6 8 -1,4 -0,2 -0,5 … 4 A 3,84 4,16 -2,08 0,28 -0,60 -1,40 -0,96 3,56 0,2 6,6 1
Shunday qilib, quyidagi 1
=1,00002 , 2
=2,00005 , 3
=3,00009 , 4
=4,00013 taqribiy yechimga ega bo‘ldik. Sistemaning aniq yechimi 1
=1, 2
=2, 3
=3, 4
=4 ekanligiga bevosita ishonch hosil qilish mumkin. Misol. Quyidagi ko‘rinishdagi chiziqli algebraik tenglamalar sistemasini Gauss usuli yordamida yechish algoritmi va dasturini tuzing. 11 1
2 1 1 1 21 1 22 2 2 2 1 1 1 2 2 1 ...
... ......
... n n n n n n n n nn n nn a x a x a x a a x a x a x a a x a x a x a + + + + + + = + + + = + + + =
4,1 … 1 1,8 … - 0,5416 6 -3 … - 0,15625 1,6 … -0,25 4,5 … 0,05208 - 2,5333 1 - 4,0208 1 … 1 0,75 2,35937 … - 0,29606 -4,6 - 2,62500 … 1,81581 -6,38331 -4,28644 … 2,51198 2
1,16897 4,67603 5,84500 3
1 1 1 1 4,00013 3,00009 2,00005 1,00002 5,00013 4,00009 3,00005 2,00002 В Algoritmi:
begin
n j i a ,
n i , 1 =
, 1 =
j
+ +
i a c , 1 + =
1 ,
= n k j
i k k j k j i a c a a a , 1 , , , 1 + + − =
1 ,
= n k i
0 , 1 = + k l a
n k , 1 =
0 , = k k a
1 ,
= n k p
k a d , = p l kp a a , 1 + =
d a p l = + , 1 1
n n n n n a a x , 1 , + = n k i , 1 + =
i i k x a S S , + = 1
, 1 − = n k
k n k k a S a x , 1 , − = + n i , 1 =
x
end 1 Dastur i: 11 1 12 2 1 1 21 1 22 2 2 2 1 1 2 2 ... ... ......
... n n n n n n nn n n a x a x a x b a x a x a x b a x a x a x b + + + = + + + = + + + =
Program Gauss1; label 1,2,3,4,5; var a:array[1..10, 1..10] of real; b,x:array[1..10] of real; c,s:real; i,j,k,n:integer; readln(n); for i:=1 to n do for j:=1 to n do read(a[i,j]); readln(b[i]); end; k:=1; 3: i:=k+1; 2: c:=a[i,k]/a[k,k]; a[i,k]:=0; j:=k+1; 1: a[i,j]:=a[i,j]-c*a[k,j]; if j b[i]:=b[i]-c*b[k]; if i if k x[n]:=b[n]/a[n,n];
i:=n-1; 5: j:=i+1;
s:=0; 4: s:=s+a[i,j]*x[j];
if j x[i]:=(b[i]-s)/a[i,i];
if i>1 then begin i:=i-1; goto 5 end; for i:=1 to n do
writeln(x[i]:4:2); end.
11 1 12 2 1 1 1 21 1 22 2 2 2 1 1 1 2 2 1 ...
... ......
... n n n n n n n n nn n nn a x a x a x a a x a x a x a a x a x a x a + + + + + + = + + + = + + + =
program Gauss; var a:array[1..10, 1..10] of real; x:array[1..10] of real; c,s,d:real; i,j,k,n,l,p:integer; begin readln(n); for i:=1 to n do for j:=1 to n+1 do readln(a[i,j]); for k:=1 to n do begin l:=k; while a[k,k]=0 do begin if a[l+1,k]=0 then else begin for p:=k to n+1 do7 begin d:=a[k,p]; a[k,p]:=a[l+1,p]; a[l+1,p]:=d; end; break; end; l:=l+1; end; for i:=k to n-1 do begin c:=a[i+1,k]; for j:=k to n+1 do a[i+1,j]:=(a[k,j]/a[k,k])*c-a[i+1,j]; end; end; x[n]:=a[n,n+1]/a[n,n]; for k:=n-1 downto 1 do begin s:=0; for i:=k+1 to n do s:=s+a[k,i]*x[i]; x[k]:=(a[k,n+1]-s)/a[k,k] end; for i:=1 to n do writeln(x[i]:4:2); end.
2-masala. Quyidagi chiziqli tenglamalar sistemasini yeching: 1 2 3 4 1 2 3 1 3 4 1 2 3 4 3 5 7 2 5 3 1 2 4 3 6 6 4 3 2 3 x x x x x x x x x x x x x x − + + = + − = − − − + = + − − =
B AX = ko`rinishda yozib olamiz. Bu yerda A – noma`lumlar koeffisentlardan tashkil topgan matritsa, B– ozod hadlardan tashkil topgan ustun (vektor), X– noma`lumlar ustuni (vektori). 3 -1 5 1 2 5 -3 0 -2 0 -4 3 6 4 -3 -2
= , 7 1
=
−
, 1 2 x X x
=
Demak,
B A X 1 − = . A matritsani, ya`ni noma`lumlar koeffisentlarini A1:D4 maydonga, B vektorni, ya`ni ozod hadlarni F1:F4 maydonga kiritamiz. X vektor uchun H1:H4 maydonni belgilab =МУМНОЖ(МОБР(A1:D4);F1:F4) formulani kiritamiz va Ctrl+Shift+Enter tugmalarini birgalikda bosamiz. Natijada H1:H4 maydonda izlanayotgan noma`lumlar hosil bo`ladi:
Document Outline
Download 0.62 Mb. Do'stlaringiz bilan baham: |
ma'muriyatiga murojaat qiling