Ishdan maqsad: Talabalarda algoritmlarni asimptotik tahlil qilish haqida ko’nikmalar hosil


Urinmalar usuli uchun dastur kodi



Yüklə 1,47 Mb.
Pdf görüntüsü
səhifə6/6
tarix29.07.2023
ölçüsü1,47 Mb.
#137872
1   2   3   4   5   6
Urinmalar usuli uchun dastur kodi: 
Program Urinma; 
Label 1,2,3,4; 
Var a,b,x1, x2, eps : real; 
Function F (x: real): real; Begin F: = … end; 
Function F 1(x: real): real; Begin F 1: = … end; 
Function F 2(x: real): real; Begin F 2: = … end; 
Begin
writeln(‘a,b=’); readln(a,b); 
writeln(‘ aniqlikni kiriting'); readln( eps); 
if F1(a)*F2(a)>0 then x1:=b else goto 2; 
1: x2:=x1 – F(x1) / F1(x1); 
If abs(x2-x1)>eps then begin x1:=x2;goto1 end else goto3; 
2 : if F1(a)*F2(a)<0 then x1:=a; 
4: x2:=x1 – F(x1) / F1(x1); 
If abs(x2-x1)>eps then begin x1:=x2;goto 4 end ; 
3 : Writeln (‘tenglama yechimi= ‘,x); End. 
 
Vatarlar usuli 
f(x)=0 tenglama berilgan. Biror [a;b] oraliqda f(a)*f(b)<0 bo’lsin. [a;b] oraliqdagi (a,f(a)) 
va (b,f(b)) nuqtalardan vatar o’tkazamiz. 


0
1
1
0
1
1
y
y
y
y
x
x
x
x





)
(
)
(
)
(
)
(
0
0
0
0
1
x
b
x
f
b
f
x
f
x
x




)
(
)
(
1
0
1
0
b
f
y
a
f
y
b
x
a
x




)
(
)
(
)
(
)
(
1
1
1
1
2
x
b
x
f
b
f
x
f
x
x




)
(
)
(
)
(
a
f
b
f
a
f
y
a
b
a
x





)
(
)
(
)
(
)
(
1
n
n
n
n
n
x
b
x
f
b
f
x
f
x
x





(1.11)










0
y
)
(
)
(
)
(
a
f
b
f
a
f
y
a
b
a
x




n
n
x
x
1
(1.12)
Misol
.
𝑒
𝑥
− 10𝑥 − 2 = 0
tenglamaning 

=0. 01 aniqlikdagi taqribiy ildizi topilsin.
Yechish
. Ma’lumki 
𝑓(𝑥) = 𝑒
𝑥
− 10𝑥 − 2
funksiya [-1;0] oraliqda teoremalarning hamma 
shartlarini bajaradi. x

[-1;0] da ikkinchi tartibli hosila 
𝑓
′′
(𝑥) = 𝑦𝑒
𝑥
> 0
. Demak f(0)=-1, f(-
1)=8.368 bo`lganligi uchun, f(a)*f(b)<0 shartga asosan f(0)f''(0)<0 bo`lgani uchun {
a
n
} ketma-
ketlik vatarni topish formulasi bilan topiladi.
Berilganlar:
a
=-1, 
b
=0, 

=0. 01
f(x)= ye
x
-10x-2, f(-1)=e
-1
-10(-1) -2=8. 386, f(0)=e
0
-10*0-2=-1 
vatar ildizlarini topish formulasiga asosan: 

b
0
=
 0 


1=
 b
0
- (
a- b
0
) f(
b
0
)/ (f(
a
)-f(
b
0
))= -0.107 
Yaqinlashish sharti 

 b

- b
2

>

bo`lganligi uchun 
b
2
yaqinlashishni hisoblaymiz. Buning 
uchun 
 
b
1=
-0.107, f(-0.107)=e
-0.107
-10(-0.107)-2 =-0.038 , f(a)=f(-1)=8.386 
larga asosan: 
b
2
=
 b
1
- (
a- b
 1
) f(
b
 1
)/ (f(
a
)-f(
b
 1
)) = 0.111 

 b
2
- b
1

+

- 0.111+0.107

=0.004<

=0. 01 
Demak taqribiy yechim deb t=
 b
n
=-0.111 ni olish mumkin. 
Vatarlar usuli uchun dastur kodi: 
Program Vatar; 
Label 1,2,3,4; 
Var a,b,x1, x2, eps : real; 
Function F (x: real): real; Begin F: = … end; 
Function F 1(x: real): real; Begin F 1: = … end; 
Function F 2(x: real): real; Begin F 2: = … end; 


Begin
writeln(‘a,b=’); readln(a,b); 
writeln(‘ aniqlikni kiriting'); readln( eps); 
if F1(a)*F2(a)>0 then x1:=a else goto 2; 
1: x2:=x1 – F(x1)*(b-x1) /(F(b)-F(x1)); 
If abs(x2-x1)>eps then begin x1:=x2;goto 1 end else goto 3; 
2 : if F1(a)*F2(a)<0 then x1:=b; 
4: x2:=x1 – F(x1)*(x1-a) / (F(x1)-F(a)); 
If abs(x2-x1)>eps then begin x1:=x2;goto 4 end ; 
3 : Writeln (‘tenglama yechimi= ‘,x); 
End. 
Dastur kodida: F - tenglamani o’ng tomoni; 
F1 - tenglama o’ng tomonidan olingan birinchi hosila 
F2 - tenglama o’ng tomonidan olingan ikkinchi hosila 
a , b – oraliqni chap va o’ng chegaralari. 
Eps – hisoblash aniqligi. 
Talabalar mustaqil bajarishlari uchun topshiriqlar

1) Tenglama ildizlarini ajratish iteratsion metodi yordamida 0,001 aniqlikda hisoblash. 
2) Vatarlar va urinmalar usullari yordamida tenglama taqribiy ildizlarini 0,001 aniqlikda 
hisoblash. 
3) Tenglamaning taqribiy oraliqlari topib, ularning yaqinlashish tezligini baholash. 
1) 𝑎) ln 𝑥 + (𝑥 + 1)
3
= 0;
𝑏)𝑥
3
+ 2𝑥
2
+ 2 = 0.
2) 𝑎) 𝑥 ∗ 2
𝑥
= 1;
𝑏) 𝑥
3
− 3𝑥
2
+ 9𝑥 − 10 = 0.
3) 𝑎) √𝑥 + 1 =
1
𝑥
;
𝑏) 𝑥
3
− 2𝑥 + 2 = 0.
4) 𝑎) 𝑥 − cos 𝑥 = 0;
𝑏) 𝑥
3
+ 3𝑥 − 1 = 0.
5) 𝑎) 3𝑥 + cos 𝑥 + 1 = 0;
𝑏) 𝑥
3
+ 𝑥 − 3 = 0.
6) 𝑎) 𝑥 + ln 𝑥 = 0.5;
𝑏) 𝑥
3
+ 0.4𝑥
2
+ 0.6𝑥 − 1.6 = 0.
7) 𝑎) 2 − 𝑥 = ln 𝑥 ;
𝑏) 𝑥
3
− 0.2𝑥
2
+ 0.4𝑥 − 1.4 = 0.
8) 𝑎) (𝑥 − 1)
2
=
1
2
𝑒
𝑥
;
𝑏) 𝑥
3
− 0.1𝑥
2
+ 0.4𝑥 + 2 = 0.
9) 𝑎) (2 − 𝑥)𝑒
𝑥
= 0.5;
𝑏) 𝑥
3
+ 3𝑥
2
+ 12𝑥 + 3 = 0.
10) 𝑎) 2.2𝑥 − 2
𝑥
= 0;
𝑏) 𝑥
3
− 0.2𝑥
2
+ 0.5𝑥 − 1 = 0.
11) 𝑎) 𝑥
2
+ 4 sin 𝑥 = 0;
𝑏) 𝑥
3
− 0.1𝑥
2
+ 0.4𝑥 + 1.2 = 0.
12) 𝑎) 2𝑥 − lg 𝑥 = 7;
𝑏) 𝑥
3
− 3𝑥
2
+ 6𝑥 − 5 = 0.


13) 𝑎) 5𝑥 − 8 ln 𝑥 = 8;
𝑏) 𝑥
3
− 0.2𝑥
2
+ 0.5𝑥 − 1.4 = 0.
14) 𝑎) 3𝑥 − 𝑒
𝑥
= 0;
𝑏) 𝑥
3
+ 2𝑥 + 4 = 0.
15) 𝑎) 𝑥(𝑥 + 1)
2
= 1;
𝑏) 𝑥
3
− 3𝑥
2
+ 12𝑥 − 12 = 0.
16) 𝑎) 𝑥 = (𝑥 + 1)
3
;
𝑏) 𝑥
3
+ 0.2𝑥
2
+ 0.5𝑥 + 0.8 = 0.
17) 𝑎) 𝑥
2
= sin 𝑥 ;
𝑏) 𝑥
3
+ 4𝑥 − 6 = 0.
18) 𝑎) 𝑥
3
= sin 𝑥 ;
𝑏) 𝑥
3
+ 0.1𝑥
2
+ 0.4𝑥 − 1.2 = 0.
19) 𝑎) 𝑥 = √lg (𝑥 + 2);
𝑏) 𝑥
3
+ 3𝑥
2
+ 6𝑥 − 1 = 0.
20) 𝑎) 𝑥
2
= ln (𝑥 + 1);
𝑏) 𝑥
3
− 0.1𝑥
2
+ 0.4𝑥 − 1.5 = 0.
21) 𝑎) 2𝑥 + 𝑙𝑔𝑥 = −0.5;
𝑏) 𝑥
3
− 3𝑥
2
+ 6𝑥 − 2 = 0.
22) 𝑎) 2𝑥 + cos 𝑥 = 0.5;
𝑏) 𝑥
3
− 0.2𝑥
2
+ 0.3𝑥 − 1.2 = 0.
23) 𝑎) sin 0.5𝑥 + 1 = 𝑥
2
;
𝑏) 𝑥
3
− 3𝑥
2
+ 12𝑥 − 1.2 = 0.
24) 𝑎)0.5𝑥 + lg(𝑥 − 1) = 0.5;
𝑏) 𝑥
3
+ 0.2𝑥
2
+ 0.5𝑥 − 2 = 0.
25) 𝑎) sin(0.5 + 𝑥) = 2𝑥 − 0.5;
𝑏) 𝑥
3
+ 3𝑥 + 1 = 0.
26) 𝑎) lg(2 + 𝑥) + 2𝑥 = 3;
𝑏) 𝑥
3
+ 0.2𝑥
2
+ 0.5𝑥 − 1.2 = 0.
27) 𝑎) lg(1 + 2𝑥) = 2 − 𝑥;
𝑏) 𝑥
3
− 3𝑥
2
+ 9𝑥 + 2 = 0.
28) 𝑎)2 sin(𝑥 − 0.6) = 1.5 − 𝑥 ;
𝑏) 𝑥
3
− 0.1𝑥
2
+ 0.4𝑥 − 1.5 = 0.
29) 𝑎)𝑥 + lg(1 + 𝑥) = 1.5 ;
𝑏) 𝑥
3
− 3𝑥
2
+ 6𝑥 + 3 = 0.
30) 𝑎) 𝑥 + 𝑐𝑜𝑠𝑥 = 1;
𝑏) 𝑥
3
− 0.1𝑥
2
+ 0.3𝑥 − 0.6 = 0.
 

Yüklə 1,47 Mb.

Dostları ilə paylaş:
1   2   3   4   5   6




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin