Yechish
Berilganlarga ko‘ra
3.11-rasm. Gradiyent usuli algoritmining
blok-sxemasi.
2
2
2
2
0,1
3
0, 2
2
0,3
x
x
yz
f
y
y
xz
z
z
xy
,
1 2
2
2
3
1 2
3
2
2
1 2
x
z
y
W
z
y
x
y
x
z
,
0
0
0
0
x
.
(3.41) va (3.42) formulalar bo‘yicha quyidagi birinchi yaqinlashishni olamiz:
0
0
0
0
0
,
1
,
f
f
f
f
,
1
0
0
0,1
1
0, 2
0,3
x
x
Ef
.
Xuddi shunday
2
x
- ikkinchi yaqinlashishni aniqlaymiz. Bu yerdan:
1
0,13
0,05
0,05
f
,
1
1, 2
0,6 0, 4
0,9
1, 4
0,3
0, 4
0, 2
1,6
W
,
1
1
0,181
0,002
0,147
W f
.
1
1 1
0,181
0,002
0,147
W W f
,
2
2
2
0,13 0, 2748
0,05 0, 2098
0,05 0,1632
0,3719
0, 2748
0, 2098
0,1632
.
2
0,1
0,181
0,0327
0, 2
0,37119
0,002
0, 2007
0,3
0,147
0, 2453
x
.
Natijaning qanchalik to‘g‘ri va aniq ekanligini tekshirish uchun tafovut hisoblanadi.
136
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:
.
0
4
,
;
0
1
2
,
3
2
2
3
1
y
xy
y
x
f
y
x
y
x
f
Yechish.
Ushbu misolda berilgan tenglamalar sistemasi bitta musbat haqiqiy
yechimga ega ekanligini quyidagi Maple dasturi
plots
paketining
implication
funk-
siyasidan foydalanib
0
)
,
(
1
y
x
f
va
0
)
,
(
2
y
x
f
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
7
,
1
;
2
,
1
0
0
y
x
kabi
bo‘lsin. U holda
1
3
2
6
,
2
0
0
3
0
0
2
0
0
0
y
x
y
y
x
y
x
yoki
910
,
97
40
,
9
91
,
4
40
,
3
64
,
8
7
,
1
;
2
,
1
.
(12) formulaga ko‘ra
3.12-rasm. 1-misolda berilgan nochiziqli
tenglamalar sistemasi ildizining boshlang‘ich
yaqinlashishni grafik usul bilan Maple dasturi
yordamida aniqlash.
.
6610
,
1
0390
,
0
7
,
1
1956
,
0
91
,
4
434
,
0
64
,
8
91
,
97
1
7
,
1
;
2349
,
1
0349
,
0
2
,
1
40
,
9
1956
,
0
40
,
3
434
,
0
91
,
97
1
2
,
1
1
1
y
x
Hisoblashlarni shu singari davom ettirib,
6615
,
1
2343
,
1
2
2
y
x
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
6615
,
1
2343
,
1
2
2
y
x
- taqribiy yechimni
yetarlicha
aniqlikda topilgan deb hisoblash mumkin.
137
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:
> with(linalg):
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
x
3
y
2
1
x y
3
y
4
:=
FP
6
x
2
2
y
y
3
3
x y
2
1
:=
FPINV
3
x y
2
1
2 (
)
9
x
3
y
2
3
x
2
y
4
y
9
x
3
y
2
3
x
2
y
4
y
3
2 (
)
9
x
3
y
2
3
x
2
y
4
3
x
2
9
x
3
y
2
3
x
2
y
4
:=
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:
.
0
7
,
0
1
,
0
2
,
0
,
;
0
3
,
0
2
,
0
1
,
0
,
2
2
2
2
1
xy
y
x
y
x
f
y
x
x
y
x
f
138
Yechish.
Boshlang‘ich yaqinlashishni tanlab olish uchun grafik usuldan, Maple
dasturi
plots
paketining
implication
funksiyasidan foydalanib, (
x
,
y
) tekislikning biz-
ni qiziqtiradigan sohasida
0
)
,
(
1
y
x
f
va
0
)
,
(
2
y
x
f
egri chiziqlarning grafikla-
rini chizamiz (3.13-rasm):
>
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
;
25
,
0
0
x
75
,
0
0
y
deb qabul qilamiz. U holda qara-
layotgan misol uchun quyidagilarni yozamiz:
,
0
7
,
0
1
,
0
2
,
0
,
;
0
3
,
0
2
,
0
1
,
0
,
0
0
0
2
0
0
0
2
2
0
0
2
0
0
0
1
y
x
y
x
y
x
f
y
x
x
y
x
f
1
2
,
0
)
,
(
0
0
0
1
x
x
y
x
f
;
0
0
1
4
,
0
)
,
(
y
y
y
x
f
;
3.13-rasm. 2-misolda berilgan
tenglamalar sistemasi ildizining
boshlang‘ich yaqinlashishini grafik
usul bilan aniqlash.
0
0
0
0
2
1
,
0
4
,
0
)
,
(
y
x
x
y
x
f
;
0
0
0
2
1
,
0
1
)
,
(
x
y
y
x
f
.
Tanlangan
)
,
(
0
0
0
y
x
X
larni (3.12) ning o‘ng tarafiga qo‘yib, dastlab taqribiy
)
,
(
1
1
1
y
x
X
ni topamiz:
,
70654
,
0
97969
,
0
04258
,
0
75
,
0
;
19498
,
0
97969
,
0
05391
,
0
25
,
0
1
1
y
x
o‘z navbatida esa
)
,
(
2
2
2
y
x
X
= (0,19646, 0,70615) ni va
)
,
(
3
3
3
y
x
X
=
(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:
> with(linalg):
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);
139
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
x
2
x
0.2
y
2
0.3
0.2
x
2
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
3-Misol.
Faraz qilaylik, ushbu
0
5
,
;
0
1
,
3
2
2
2
3
1
y
y
x
y
x
f
y
xy
y
x
f
nochiqli tenglamalar sistemasining aniq yechimi
(
x
,
y
)=(2;1) bo‘lib, uni dastlab analitik usulda Maple
dasturi yordamida, keyin esa uning taqribiy
yechimini Nyuton usulida topaylik.
Yechish.
Dastlab berilgan nochiqli tenglama-
lar sistemasining yechimi mavjudligini Maple
dasturi yordamida grafik usulda aniqlaylik (3.14-
rasm):
> plots[implicitplot]({x*y-y^3-1=0,x^2*y^2+y^3-
5=0},x=-5..5,y=0..2);
Berilgan nochiqli tenglamalar sistemasining
aniq yechimi analitik usulda Maple dasturi
yordamida quyidagicha topiladi:
> solve({x*y-y^3-1=0,x^2*y^2+y^3-5=0},{x,y});
{
}
,
x
2
y
1
3.14-rasm. 3-misolda berilgan
tenglamalar sistemasi ildizining
boshlang‘ich yaqinlashishini
grafik usul bilan aniqlash.
Dostları ilə paylaş: |