Uploaded by krid416

Xaitboyev Doston...

advertisement
CHIZIQLI ALGEBRAIK
TENGLAMALAR SISTEMASI
(CHATS)NI TAQRIBIY
YECHISHNING ODDIY
ITERATSIYA VA ZEYDEL
USULLARI
Bajardi: Xaitboyev Doston.
Tekshirdi: Ahmatova Sitorabonu.
Reja:
1.Chiziqli algebraik tenglamalar sistemasini
yechishning iteratsiya usuli.
2.Zeydel usuli.
3.Misol va dastur.
ChATSning umumiy ko’rinishi:
Oddiy iteratsiya usuli:
1) Yaqinlashish sharti: ChATSning har bir
tenglamasi uchun quyidagi shart bajarilishi lozim
2) Quyidagi rekurrent formula yordamida
qadamma-qadam ChATSning ildizlari
hisoblaniladi:
S=1,2,3,… - usul qadami
S=0 da x larning boshlangich qiymati sifatida
nol (ozod hadlar) olinadi:
3) Quyidagi shart bajarilganda hisoblash
qadami to’xtatiladi:
Oxirgi qadamda topilgan x larning qiymatlari
berilgan tenglamaning taqribiy yechimi sifatida
qabul qilinadi.
Agar shart bajarilmasa 2) bandga o’tiladi
Misol:
Yechish:
Quyidagicha jadval hosil qilinadi:
Algoritm:
No
Yes
Quyidagicha dastur natijasi hosil qilinadi:
Gauss – Zeydelning iteratsiya usuli
Quyidagi chiziqli tenglamalar sistemasini Gayss-Zeydel usulida yechamiz.
a11 x1+a12 x 2+a13 x3+a14 x 4=b1

a 21 x1+a22 x 2+a23 x3+a24 x 4=b2

a31 x1+a32 x 2+a33 x3+a34 x 4=b3
a x +a x +a x +a x =b
 41 1 42 2 43 3 44 4 4
(3.72)
Aytaylik, aii  0 i=1,2,3,4 bo‘lsin. Berilgan sistemani
 x1=(b1-a12 x2 -a13 x3 -a14 x4 )/a11
 x =(b -a x -a x -a x )/a
 2 2 11 1 23 3 24 4 22
(3.73)

 x3=(b3 -a31 x1-a32 x2 -a34 x4 )/a 33
 x4=(b4 -a 41 x1-a 42 x2 -a 43 x3 )/a 44
ko‘rinishga keltiramiz.
Bu sistemaning yechimini topish uchun birorta boshlang‘ich yaqinlashishni tanlab
(0) (0) (0) (0)
x ,x ,x ,x
1
2
3
4
Bu boshlang‘ich yaqinlashish asosida (3.73) tenglamaning birinchi tenglamasidan
x (1)  (b  a x (0)  a x (0)  a x (0) ) / a
1
2
12 2
13 3
14 4
11
ikkinchi tenglamasidan
x (1)  (b  a x (1)  a x (0)  a x (0) ) / a
2
2
21 1
23 3
24 4
22
uchinchi tenglamasidan
x (1)  (b  a x (1)  a x (1)  a x (0) ) / a
3
3
31 1
32 2
34 4
33
to‘rtinchi tenglamasidan esa
(1)
(1)
(1)
(1)
x4  (b4  a41x1  a42 x2  a43x3 ) / a44
larni hisoblab topamiz.
Xuddi shu yo‘l bilan k-1 yaqinlashish asosida k-chi yaqinlashishni quyidagicha topamiz:
x (k )
1
x (k )
2
x (k )
3
x (k )
4
 (b  a x ( k  1)  a x ( k  1)  a x ( k  1) ) / a
1
12 2
13 3
14 4
11
 (b  a x ( k )  a x ( k  1)  a x ( k  1) ) / a
2
21 1
23 3
24 4
22
 (b  a x ( k )  a x ( k )  a x ( k  1) ) / a
3
31 1
32 2
34 4
33
 (b  a x ( k )  a x ( k )  a x ( k ) ) / a
4
41 1
42 2
34 43
44
Umuman, agar (4.72) tenglamalar sistemasi o‘rniga n noma’lum n chiziqli tenglamalar sistemasi
berilgan bo‘lib, a ii  0, i  1, n bo‘lsa, k-yaqinlashish uchun
(k )
(k )
(k )
(k  1)
(k  1)
x  (b  a x  ...  a
x
a
x
 ...  a
x
)/a
i
i i1 1
i, i  1 i  1 i, i  1 i  1
i, n  1 n  1
ii
formula hosil bo‘ladi.
Iteratsiya jarayoni
(k )
(k  1)
max xi
 xi

shart bajarilguncha davom etadi (>0 berilgan aniqlik).
Bu iteratsiya jarayonining yaqinlashishi uchun
 aij  aii ,
j  1, i  j
tengsizliklarning bajarilishi etarlidir.
i  1, n
(3.74 )
Zeydel usuliga dastur
n=int(input("N="))
eps=0.0001
a=[[0]*n for _ in ' '*n]
b=[0]*n
x=[0]*n
x1=[0]*n
for i in range(n):
for j in range(n):
print('a[',i+1,',',j+1,']=',sep='',end='')
a[i][j]=float(input())
print('b[',i+1,']=',sep='',end='‘)
b[i]=float(input())
for i in range(n):
c=a[i][i]
for j in range(n):
a[i][j]/=c
x[i]=b[i]=b[i]/c
while 1:
for i in range(n):
a[i][i]=0
for i in range(n):
c1=0
for j in range(n):
c1+=a[i][j]*(x[j] if i<j+1 else x1[j])
x1[i]=b[i]-c1
if max(abs(x[i]-x1[i])
for i in range(n))<eps:
break
x=x1[:]
print('Javob x =',*x)
E’tiboringiz uchun
rahmat !
Download