Yechilishi:
Quyida shu misolning C++ dastur kodi va natijasi keltirilgan.
1.1-topshiriq varianlari
Berilgan integralni Simpson hamda Monte-Karlo usulida hisoblang. Oraliqni bo’linish soni
N
, hamda sinovlar soni
M
ko’rsatilgan.
№
𝒇(𝒙)
[𝒂, 𝒃]
𝑵
𝑴
1.
𝑠𝑖𝑛(𝑥 + 3) ∙ 𝑙𝑛(𝑥
2
+ 3𝑥 + 1)
[0;1]
12
100
2.
𝑐𝑜𝑠(𝑥
2
+ 𝑥 + 1) ∙ 𝑒
−𝑥
2
+𝑥+2
[0;2]
18
180
3.
(𝑥
2
+ 3𝑥 + 1) ∙ 𝑡𝑔(𝑥 − 0,5)
[0,5;1,5]
10
160
4.
𝑙𝑛(𝑥
2
+ 3) ∙ 𝑠𝑖𝑛
2
(𝑥 + 1)
[0;1]
12
100
5.
𝑠𝑖𝑛
2
(𝑥 + 1) ∙ 𝑒
−𝑥
2
[0;1]
14
150
6.
𝑠𝑖𝑛(𝑥
2
+ 2) ∙ 𝑒
−𝑥
2
[0;1]
10
180
7.
𝑐𝑜𝑠(𝑥
2
+ 1) ∙ √𝑥
3
+ 3𝑥 + 1
3
[0;2]
20
160
8.
(𝑥
2
+ 5) ∙ 𝑡𝑔(𝑥
2
+ 1)
[0;1]
12
100
9.
√𝑥
2
+ 𝑥 + 4
3
∙ 𝑠𝑖𝑛(𝑥
2
+ 1)
[-1;1]
20
150
10.
𝑒
−𝑥
2
∙ 𝑠𝑖𝑛(𝑥
2
+ 1)
[0;1]
10
140
11.
𝑠𝑖𝑛(𝑥
2
+ 𝑥 + 1)
(𝑥
3
+ 5𝑥 + 1)
[0;1]
10
140
12.
𝑒
−𝑥
2
+𝑥+1
/(𝑥
3
+ 5)
[1;2]
12
100
13.
(𝑥
2
+ 𝑥 + 1)/√𝑥
3
+ 5
[0;2]
20
150
14.
√𝑥
2
+ 5 ∙ 𝑙𝑛(𝑥
2
+ 𝑥 + 3)
[0;1]
10
110
15.
√𝑥
2
+ 3𝑥 + 1
3
∙ 𝑒
−𝑥
2
[1;2]
12
200
16.
𝑒
𝑥
2
∙ 𝑡𝑔𝑥
2
[0;1]
10
120
17.
𝑐𝑜𝑠𝑥
2
∙ √𝑥
3
+ 2𝑥 + 1
[0;2]
18
200
18.
ln(𝑥
2
+ 1) ∙ √𝑥
2
+ 3𝑥 + 1
3
[1;3]
16
150
19.
𝑐𝑜𝑠(𝑥
2
+ 1) ∙ 𝑒
−𝑥
2
[0;1]
10
100
20.
𝑒
−𝑥
2
∙ √𝑥
2
+ 7𝑥 + 1
3
[1;3]
16
120
21.
𝑒
−𝑥
2
∙ (𝑥
3
+ 𝑥 + 1)
[1;3]
20
140
22.
𝑠𝑖𝑛𝑥
2
∙ 𝑒
−𝑥
2
+ 1
[0;2]
16
200
23.
𝑐𝑜𝑠(𝑥
2
+ 1) ∙ √𝑥
2
+ 5𝑥 + 8
3
[0;1]
10
160
24.
𝑒
𝑥
∙ 𝑠𝑖𝑛(𝑥
2
+ 2)
[0;1]
10
100
25.
(𝑥
2
+ 𝑥) ∙ ln 𝑥
[1;3]
12
120
26.
𝑒
𝑥
/(𝑥
3
+ 3𝑥
2
+ 2𝑥 + 1)
[0;2]
14
150
27.
𝑠𝑖𝑛(𝑥
2
+ 𝑥) ∙ 𝑙𝑛(𝑥
2
+ 3)
[0;2]
18
200
28.
𝑡𝑔(𝑥
2
+ 1) ∙ ln 𝑥
[0;0,5]
10
100
29.
𝑠𝑖𝑛𝑥 ∙ √𝑥
2
+ 1
[0;2]
20
150
30.
𝑒
−𝑥
2
∙ 𝑠𝑖𝑛(𝑥 + 1)
[1;2]
12
100
1.2. Algebraik va transtsendent tenglamalarni yechishda oraliqni teng ikkiga bo’lish,
iteratsiya usullari.
Tenglamaning ildizi mavjudligi sharti:
Agar biror [
a,b
]
oraliqda
y = f(x)
funksiya uzluksiz bo‘lib,
f(a) · f(b) < 0
bo‘lsa, shu oraliqda
f(x)=0
tenglamaning kamida bitta ildizi mavjud bo‘ladi.
Agar biror [
a,b
] oraliqda
y=f(x)
funksiya uzluksiz bo‘lib, birinchi tartibli uzluksiz xosilaga
ega bo‘lsa va
f(a) · f(b) < 0 , f ‘ (x)
(
[
a,b
] da ishorasi o‘zgarmasa) shartlar bajarilsa,
f(x)=0
tenglama shu oraliqda yagona xaqiqiy ildizga ega bo‘ladi.
Algebraik tenglamaning taqribiy yechimini berilgan [a;b] oraliqda topishni quyidagi
algoritm bo’yicha tashkil qilamiz:
1. Berilgan [a;b] oraliqni o’rtasini hisoblaymiz.
2
b
a
C
(1.7)
2. Yechimni [a;c] yoki [c;b] oraliqdaligini
f(a)
f(c)<0
(1.8)
shartidan foydalanib aniqlaymiz.
3.
Shartni qanoatlantiradigan oraliqni yangi oraliq sifatida olamiz va uni teng ikkiga
bo’lib, yuqoridagi amallarni yana takrorlaymiz.
4.
Odatda tenglamaning taqribiy yechimini birorta aniqlik bilan topish so’raladi.
Demak δ aniqlik berilgan bo’lsa, oraliqni bo’lish jarayonining xar bir qadamida ׀ b-a ׀ < δ (1.9)
shart bajarilishi tekshiriladi. Shart bajarilganda oraliqning o’rta nuqtasi x
*
, δ aniqlik bilan
topilgan taqribiy yechim sifatida qabul qilinadi. Yangi oraliq uchun yuqoridagi ishlarni qayta
takrorlaymiz va buni oraliq uzunligi δ -dan kichik bo’lmaguncha davom ettiramiz. Oxirgi oraliqni
o’rta nuqtasini tenglamaning taqribiy yechimi sifatida qabul qilish mumkin.Oraliqni teng ikkiga
bo’lish usulining algoritmi:
F (x) =…
с=(a+b)/2
f(a)
f(
с
)<0
b=c
a=c
b-a<
E
с
a,b
F(a)
(f(b)
0
Е
ха
йук
ха
ха
йук
йук
Oraliqni teng ikkiga bo’lish usuli uchun dastur kodi:
program ikkiga_bolish;
var a,b,eps:real;
function f(x:real):real;
begin f:= {tenglamani o'ng tarafini yozing} end;
begin
write('a,b,eps=?');readln(a,b,eps);
1 : c:=(a+b)/2;
if f(a)*f(c)<0 then b:=c else a:=c;
if (b-a)> e then goto 1;
write(' Yechim =' , (a+b)/2)
end.
1-Vazifa.
Tenglamalar yechimlari joylashgan [a; b] oraliqni grafik va analitik usullar bilan
ajrating.
2-Vazifa.
Tenglamalar yechimlari joylashgan oraliqlar aniqlangandan so’ng taqribiy
yechimlarini oraliqni teng ikkiga bo’lish usulida E=0.001 aniqlikda hisoblang. Algoritmini tuzib,
dasturlash tilida dastur kodini yozib natija oling.
3-Vazifa
. Algebraik va transtsendent tenglamalarning taqribiy yechimlarini vatarlar va
urinmalar usuli bilan toping. Algoritmini tuzib, dasturlash tilida dastur kodini yozib natija oling.
Laboratoriya ishiga doir topshiriq variantlari:
1. a) 2x
3
-2x-1=0
b) 3x+cosx+1=0
2. a) x
3
-x
7=0
b) lnx+2
x
=0
3. a) 2x
3
-2x
2
+3x+1=0
b) x+cosx-1=0
4. a) 2x
3
-x-5=0
b)
x
x
1
1
.
5. a) x
3
-3x
2
+2x-4=0
b) x
2
+4
sinx=0
6. a) x
3
+2x
2
+5x+2=0
b) lnx+x+1=0
7. a) 2x
3
+2x-4=0
b) 2x-lgx=3
8. a) x
3
-2x
2
+7x-1=0
b)
x
x
lg(
)
2
9. a) 2x
3
+3x+4=0
b) x
2
=3sinx
10. a) x
3
-3x
2
+6x+2=0
b) 3x-2lnx=4
11. a) x
3
-2x+2=0
b) 4x-e
x
=0
12. a) x
3
-3x
2
+2x-4=0
b) x
(x+1)
2
=2
13. a) x
3
+x-8=0
b) 3-2x=lnx
14. a) x
3
-3x
2
+5x+1=0
b) 2x-cosx=0
15. a) x
3
-x+2=0
b) sin(x/2)+1=x
2
16. a) x
3
-3x
2
+7x+1=0
b) 2x+lgx=-0,5
17. a) x
3
-3x+1=0
b) (2-x)
e
x
=1
18. a) x
3
+x
2
+2x+4=0
b) x
3
=2sinx
19. a) x
3
-2x-5=0
b) 2x-2
x
=0
20. a) x
3
+2x
2
+3x-2=0
b) x
2
-4
sinx=0
21. a) x
3
+4x-6=0
b) x
2
=ln(x+2)
22. a) x
3
-3x
2
+6x-5=0
b) 2x-cosx=0
23. a) x
3
-2x+7=0
b) 3x+cosx=2
24. a) x
3
-4x+1=0
b) x+lgx=1,5
25. a) x
3
+2x
1=0
b) x
2
x
-3=0
26. a) 2x
3
-3x-5=0
b) 2x-2
x-1
=0
27. a) x
3
+(1/2)x-2=0
b) x
2
-sosx=0
28. a) x
3
-x+1=0
b) (2+x)
e
x
=1
29. a) x
3
+x
2
+x+4=0
b) x
3
=2cos(x)
30. a) x
3
-3x+15=0
b) 2x-e
x
=0
Tenglamalarni yechishda Nyuton va vatarlar usullari. Yaqinlashish tezligi.
Nyuton (Urinmalar)
usuli.
f(x)=0 tenglama berilgan. Biror [a;b] oraliqda f(a)*f(b)<0 bo’lsin. [a,b] oraliqdagi (b,f(b))
nuqtadan urinma o’tkazamiz.
)
)(
(
0
0
0
x
x
x
f
y
y
)
(
,
0
0
b
f
y
b
х
0
)
)(
(
)
(
y
b
x
b
f
b
f
y
)
(
)
(
1
b
f
b
f
b
x
0
x
b
)
(
)
(
0
0
0
1
x
f
x
f
x
x
)
(
)
(
1
1
1
2
x
f
x
f
x
x
..........
..........
)
(
)
(
1
n
n
n
n
x
f
x
f
x
x
(1.10)
n
n
x
x
1
(1.11)
Nyuton (Urinma) usuli yordamida [a;b] oraliqda
n
n
x
x
1
aniqlida taqribiy ildizlarini
topish algoritm blok sxemasi.
Misol
.
e
x
− 10x − 2 = 0
tenglama taqribiy yechimini
=0.01 aniqlik bilan toping.
Yechish.
F(x) = e
x
− 10x − 2 = 0
funktsiya
[-1;0]
oraliqda 1.3-teoremaning barcha shartlarini
qanoatlantiradi.
𝑓
′′
(x) = e
x
> 0
, x
[-1;0]
va
f
(-1)=8.386>0
dan
𝑓(−1)𝑓
′′
(−1) > 0
bo’lgani uchun
a
0
=-1 deb olinadi.
𝑓
′
(−1) = 𝑒
−1
− 10 = −9.632
ni e’tiborga olib, birinchi
yaqinlashish
a
1
ni hisoblaymiz:
𝑎
1
= 𝑎 −
𝑓(𝑎)
𝑓
′
(−1)
= −1 −
8.386
−9.632
= −0.131.
Yaqinlashish shartini tekshiramiz:
a
1
-
a
0
=
-0.131+1
= 0.869>
=0.01
bo’lgani uchun ikkinchi yaqinlashish
a
2
ni
𝑎
2
= 𝑎
1
−
𝑓(𝑎
1
)
𝑓
′
(a
1
)
formula bilan topamiz.
𝑓(𝑎
1
) = 𝑒
−0.131
+ 10(0.131) − 2 = 0.1895,
𝑓
′
(𝑎
1
) = 𝑦𝑒
−0.131
− 10 = −9.123
lar asosida:
a
2
=-0.131- 0.1895/(-9.123) = -0.1104.
Yana
a
2
- a
1
=
0.0214 >
bo’lgani uchun
a
3
ni topamiz.
lar asosida:
𝑎
3
= 𝑎
2
−
𝑓(𝑎
2
)
𝑓
′
(𝑎
2
)
= −0.1104 −
0.0006
−0.1046
= −0.1104,
yaqinlashish sharti
a
3
-
a
2
<
=0.01 bajarilganligi uchun tenglamaning
=0.01 aniqlikdagi
taqribiy yechimi:
x
a
3
= -0.11 bo’ladi.
0>0>0>0> Dostları ilə paylaş: |