1-misol. Tezkor tushish usili (gradi- yent usuli) yordamida ushbu
x x2 2 yz 0,1;
y y2 3xz 0, 2;
z z2 2xy 0,3.
tenglamalar sistemaning koordinata boshi atrofida yotgan ildizlarini taqribiy hisoblang.
Yechish Berilganlarga ko‘ra
|
|
3.11-rasm. Gradiyent usuli algoritmining blok-sxemasi.
|
x x2 2 yz 0,1
1 2x
2z
2 y
0
f y y2 3xz 0, 2 ,
W 3z
1 2 y 3x ,
x0 0 .
z z2 2xy 0,3
2 y
2x 1 2z
0
(3.41) va (3.42) formulalar bo‘yicha quyidagi birinchi yaqinlashishni olamiz:
f 0, f 0
0,1
1,
x1 x0 1 Ef 0 0, 2 .
0 f 0, f 0
0,3
Xuddi shunday
x2
- ikkinchi yaqinlashishni aniqlaymiz. Bu yerdan:
f 1 0,13 ,
1, 2
W
0,6 0, 4
,
W f 1 0,181 .
0,05
0,05
1 0,9 1, 4 0,3 1
0, 4 0, 2 1,6
0,002
0,147
WW f 1 0,181 ,
0,13 0, 2748 0,05 0, 2098 0,05 0,1632 0,3719 .
1 1 0,002
0,147
x2
0, 27482 0, 20982 0,16322
0,1 0,181 0,0327
0,37119 .
0, 2 0,002 0, 2007
0,3
0,147
0, 2453
Natijaning qanchalik to‘g‘ri va aniq ekanligini tekshirish uchun tafovut hisoblanadi.
135
Namunaviy misollar va ularning yechimlari
Nochiziqli tenglamalar sistemasini Maple dasturi yordamida taqribiy yechish.
1-misol. Quyidagi nochiziqli tenglamalar sistemaning yechimini = 0,001 aniqlik bilan Nyuton usulida taqribiy hisoblang:
f1x, y 2x3 y2 1 0;
2
f x, y xy3 y 4 0.
Yechish. Ushbu misolda berilgan tenglamalar sistemasi bitta musbat haqiqiy yechimga ega ekanligini quyidagi Maple dasturi plots paketining implication funk-
siyasidan foydalanib f1(x, y) 0 va f2 (x, y) 0 funksiyalarning chizil- gan grafiklaridan ko‘rish mumkin (3.12-rasm):
plots[implicitplot]({2*x^3-y^2-
1=0,x*y^3-y-4=0},x=-2..2,y=-3..3);
Bu usulga ko‘ra dastlabki yaqinlashish x0 1,2; y0 1,7 kabi bo‘lsin. U holda
6x0 2 y0 yoki
2
x0 , y0
y3 3x y2 1
0 0 0
1,2; 1,7 8,64 3,40 97,910 .
4,91 9,40
(12) formulaga ko‘ra
|
3.12-rasm. 1-misolda berilgan nochiziqli tenglamalar sistemasi ildizining boshlang‘ich yaqinlashishni grafik usul bilan Maple dasturi yordamida aniqlash.
|
x1 1,2
0,434
0,1956
8,64
3,40
9,40
0,434
1,2 0,0349
1,2349 ;
y1 1,7
4,91
0,1956
1,7 0,0390
1,6610 .
Hisoblashlarni shu singari davom ettirib,
x2 1,2343
y2 1,6615
ni topamiz va
hisoblashlarni talab qilingan aniqlikkacha davom ettiramiz.
Berilgan tenglamalar sistemasining mavjud bitta haqiqiy yechimini Maple dasturi yordamida ham analitik usulda aniqlaylik:
solve({2*x^3-y^2-1=0,x*y^3-y-4=0},{x,y}); allvalues(%); evalf(%);
{ x 1.234274484, y 1.661526467}
Natijalardan ko‘rinadiki, topilgan
x2 1,2343
y2 1,6615
- taqribiy yechimni
yetarlicha aniqlikda topilgan deb hisoblash mumkin.
136
Endu bu masalani Maple tizimida sonli yechishni qaraymiz. Avvalo Yakob matritsasini linalg paketining jacobian funksiyasi yordamida hisoblaymiz, keyin esa uning teskarisini linalg paketining inverse funksiyasidan foydalanib hisoblaymiz. eval funksiyasi ifodaning son qiymatini beradi. evalm funksiyasi esa matritsa va vektorlar ustida amal bajarib, son natija beradi. Boshlang‘ich vektorni xx va eps aniqlik darajasi deb, Nyuton usuli bo‘yicha taqribiy hisoblashlarni bajaramiz:
F:=(x,y)->[2*x^3-y^2-1,x*y^3-y-4];
FP:=jacobian(F(x,y),[x,y]); FPINV:=inverse(FP);
xx:=[1.2,1.7]; eps:=0.0001; Err:=1000; v:=xx; v1:=[1e10,1e10]; j:=0:
for i while Err>eps do v1:=eval(v);
M:=eval(eval(FPINV),[x=v[1],y=v[2]]):
v:=evalm(v-M&*F(v[1],v[2])); Err:=max(abs(v1[1]-v[1]),abs(v1[2]-v[2])); j:=j+1;
end do;
Hisob natijasi quyidagicha:
F := ( x, y ) [ 2 x3 y2 1, x y3 y 4 ]
6 x2 2 y
FP := y3 3 x y2 1
3 x y2 1 y
2 ( 9 x3 y2 3 x2 y4 ) 9 x3 y2 3 x2 y4
FPINV :=
y3 3 x2
2 ( 9 x3 y2 3 x2 y4 ) 9 x3 y2 3 x2 y4
xx := [ 1.2, 1.7 ]
eps := 0.0001
Err := 1000
v := [ 1.2, 1.7 ]
v1 := [ 0.1 10 11, 0.1 10 11 ]
v1 := [ 1.2, 1.7 ]
M := 0.09600350200 0.03470990077
-0.05015580660 0.08820398313
|
v := [ 1.234876263, 1.660979681]
Err := 0.039020319
j := 1
v1 := [ 1.234876263, 1.660979681]
M := 0.09258867450 0.03335772210
-0.04601453420 0.09187560387
v := [ 1.234274675, 1.661526276]
Err := 0.000601588
j := 2
v1 := [ 1.234274675, 1.661526276]
M := 0.09264916080 0.03338417877
-0.04608134315 0.09182868696
v := [ 1.234274484, 1.661526467]
Err := 0.191 10 -6
j := 3
|
Natija shuni ko‘rsatadiki, hisob jarayonining 3-qadamida berilgan aniqlikdagi yechimga erishildi.
2-misol. Quyidagi nochiziqli tenglamalar sistemasining musbat yechimini = 0,001 aniqlik bilan Nyuton usulida taqribiy hisoblang:
1
f x, y 0,1x2 x 0,2 y2 0,3 0;
2
f2 x, y 0,2x y 0,1xy 0,7 0.
137
Yechish. Boshlang‘ich yaqinlashishni tanlab olish uchun grafik usuldan, Maple dasturi plots paketining implication funksiyasidan foydalanib, (x,y) tekislikning biz-
ni qiziqtiradigan sohasida rini chizamiz (3.13-rasm):
f1(x, y) 0 va
f2 (x, y) 0
egri chiziqlarning grafikla-
plots[implicitplot]({0.1*x^2+x+0.2*y^2-0.3=0,0.2*x^2+y-0.1*x*y-0.7=0},x=-
2..2,y=-2..2);
Bundan berilgan tenglamalar sistemasi- ning biz izlayotgan musbat yechimi 0<x<0,5; 0<y<1,0 kvadrat ichida ekanligini ko‘ramiz.
Boshlang‘ich yaqinlashishni x0 0,25; y0 0,75 deb qabul qilamiz. U holda qara- layotgan misol uchun quyidagilarni yozamiz:
f1x0 , y0 0,1x2 x 0,2 y2 0,3 0;
0 0 0
f2 x0 , y0 0,2x2 y 0,1x y 0,7 0,
0 0 0 0
f1 (x0 , y0 ) 0,2x 1 ; f1 (x , y0 ) 0,4 y ;
x 0 y 0
|
3.13-rasm. 2-misolda berilgan tenglamalar sistemasi ildizining boshlang‘ich yaqinlashishini grafik
usul bilan aniqlash.
|
f2 (x0 , y0 ) 0,4x
0,1y ;
f2 (x0 , y0 ) 1 0,1x .
x 0 0 y 0
Tanlangan
X 0 (x0 , y0 )
larni (3.12) ning o‘ng tarafiga qo‘yib, dastlab taqribiy
X1 (x1, y1 )
ni topamiz:
x 0,25 0,05391 0,19498;
1
y1 0,75
0,97969
0,04258
0,97969
0,70654,
o‘z navbatida esa
X 2 (x2 , y2 )
= (0,19646, 0,70615) ni va
X 3 (x3 , y3 ) =
(0,19641, 0,70615) ni topamiz va hokazo. Iteratsiya jarayonini (3.13) shart bajaril- gunga qadar davom ettiramiz. Bu hisoblashlar berilgan sistemaning yechimi ( x, y) = (0,1964; 0,7062) ekanligini ko‘rsatadi.
Bu topilgan yechimning qanchalik to‘g‘riligini Maple dasturi yordamida aniqlashtiramiz:
solve({0.1*x^2+x+0.2*y^2-0.3=0,0.2*x^2+y-0.1*x*y-0.7=0},{x,y});
{ x .1964115055, y .7061541848} .
Endi Nyuton usuli bilan misolning taqribiy yechimini topamiz:
F:=(x,y)->[0.1*x^2+x+0.2*y^2-0.3,0.2*x^2+y-0.1*x*y-0.7];
FP:=jacobian(F(x,y),[x,y]); FPINV:=inverse(FP);
138
xx:=[0.25,0.75]; eps:=0.0001; Err:=1000; v:=xx; v1:=[1e10,1e10]; j:=0:
for i while Err>eps do
v1:=eval(v); M:=eval(eval(FPINV),[x=v[1],y=v[2]]):
v:=evalm(v-M&*F(v[1],v[2])); Err:=max(abs(v1[1]-v[1]),abs(v1[2]-v[2])); j:=j+1; end do;
F := ( x, y ) [ 0.1 x2 x 0.2 y2 0.3, 0.2 x2 y 0.1 x y 0.7 ]
FP := 0.2 x 1 0.4 y
0.4 x 0.1 y 1 0.1 x
xx := [ 0.25, 0.75 ]
eps := 0.0001
Err := 1000
v := [ 0.25, 0.75 ]
v1 := [ 0.1 10 11, 0.1 10 11 ]
v1 := [ 0.25, 0.75 ]
M := 0.9594095941 -0.2952029520
-0.02460024600 1.033210332
v := [ 0.1969557196, 0.7064883149]
Err := 0.0530442804
j := 1
|
v1 := [ 0.1969557196, 0.7064883149]
M := 0.9642769266 -0.2779750296
-0.008000478288 1.022397604
v := [ 0.1964115443, 0.7061542263]
Err := 0.0005441753
j := 2
v1 := [ 0.1964115443, 0.7061542263]
M := 0.9643276107 -0.2778427597
-0.007819206552 1.022287533
v := [ 0.1964115055, 0.7061541848]
Err := 0.415 10 -7
j := 3
|
|
Do'stlaringiz bilan baham: |