№ |
X k
|
yk
|
f (X k;yk)
|
f (X k ;yk1)h
|
0
|
X 0
|
y0
|
f (X 0;y0)
|
y0= f (X 0 ;y0)h
|
1
|
X 1
|
y1=y0+ y0
|
f (X 1;y1)
|
y1= f (X1 ;y1)h
|
2
|
X 2
|
y2=y1+ y1
|
f (X2;y2)
|
y2= f (X 2 ;y21)h
|
…
|
….
|
………….….
|
…………
|
……………………
|
n-1
|
X n-1
|
yn-1=yn-2+ yn-2
|
f (Xn-1;yn-1)
|
yn-1= f (X n-1 ;yn-1)h
|
n
|
X n
|
yn=yn-1+ yn-1
|
f (Xn;yn)
|
|
Misol: tеnglama bеrilgan. [0;1] kеsmada хо=0, уо=1 boshlang’ich shartni qanoatlantiruvchi yеchim Teylor usuli yordamida topilsin. Qadamlar h1=0,1 vа h2=0,2 dеb olinsin. Hisob vеrguldan so’ng uch raqam bilan olib bеrilsin.
Yechish: Hisoblash qulay bo’lishi uchun jadval tuzib olamiz (h1=0,1)
1. Boshlang’ich shartlar bo’yicha jadvalning birinchi satrini to’ldirib olamiz.
х0=0 y0=1 dа bo’ladi
2. Jadvalning ikkinchi satrini to’ldiramiz.
dа
va hokazo.
Hisoblashlarni toki [0,I] oraliqni o’tib bo’lmaguncha davom ettiramiz.
№
|
x i=x 0+ih
|
yi+1=yi+yi
|
y2i
|
x 3i
|
|
|
0
|
0
|
1,000
|
1,000
|
0
|
1,000
|
0,100
|
1
|
0,1
|
1,100
|
1,210
|
0,001
|
1,000
|
0,100
|
2
|
0,2
|
1,210
|
1,440
|
0,008
|
1,006
|
0,101
|
3
|
0,3
|
1,301
|
1,692
|
0,027
|
1,016
|
0,102
|
4
|
0,4
|
1,402
|
1,966
|
0,064
|
1,033
|
0,103
|
5
|
0,5
|
1,506
|
2,256
|
0.125
|
1,055
|
0,105
|
6
|
0,6
|
1,611
|
2,595
|
0.216
|
1,083
|
0,108
|
7
|
0,7
|
1,719
|
2,956
|
0.343
|
1,116
|
0,112
|
8
|
0,8
|
1,830
|
3,350
|
0.512
|
1,153
|
0,115
|
9
|
0,9
|
1,946
|
3,768
|
0.729
|
1,26
|
0,126
|
10
|
1,0
|
2,060
|
-
|
-
|
-
|
-
|
Endi h=0,2 qadam uchun yuqoridagi kabi hisoblashlarni bajarib, jadvalni to’ldiramiz.
№
|
x i
|
yi
|
y2i
|
x 3i
|
|
|
0
|
0
|
1,000
|
1,000
|
0
|
1,000
|
0,200
|
1
|
0,2
|
1,200
|
1,440
|
0,098
|
1,006
|
0,200
|
2
|
0,4
|
1,400
|
1,960
|
0,054
|
1,030
|
0,210
|
3
|
0,6
|
1,610
|
2,592
|
0,216
|
1,080
|
0,220
|
4
|
0,8
|
1,830
|
3,350
|
0,512
|
1,100
|
0,210
|
5
|
1,0
|
2,050
|
-
|
-
|
-
|
-
|
Dеmak, ,
Shunday qilib absolyut xato nisbiy xato
Koordinatalar tеkisligida (x0,y0), (x1,y1) ,…, (x n,yn) nuqtalarni to’g’ri chiziq kеsmalari bilan tutashtirib, Teylor siniq chizig’ini hosil qilamiz:
у
2,0
1,8
1,6
1,4
1,2
1
0 0,2 0,4 0,5 0,8 1,0 1,2 х
15-chizma
An’anamizga ko’ra yuqorida namuna sifatida keltirilgan misolni dasturlab ko’ramiz.
Eyler – Koshi usuli uchun Pascalda maxsus tuzilgan dastur.
uses Crt;
const c:array[1..4] of real = (0,0.5,0.5,1);
type
coef=array[0..4] of real;
var
i,j,m:integer;
a,b,h,x,y,y1,y2:real;
k0,k:coef;
ch:char;
{ ------------------------------------------------
Подпрограммы }
{ Праvaя часть дифференциального уравнения функции- f(x,y)}
function f(x,y:real):real;
begin
f:= x+y;
end;
{ -------------------------------------------------------- }
procedure Pausa;
begin
writeln;
writeln (' Davom ettirish uhun PLAY ni bosing...');
repeat ch:=readkey
until ch <> '';
end;
{ ------------------------------------------------
Общая программа }
begin
clrscr;
writeln ('Oraliq qiymatlarini kiriting * [a,b]');
read (a,b);
writeln (' y0 ning x=x0 bo"lgandagi boshlang"ich funksiyaning qiymatini kiriting');
read (y);
writeln (' [a,b] oralig"idagi qiymatlar sonini kiriting');
read (m);
x:=a;
h:=(b-a)/m;
y1:=y;
y2:=y;
writeln (' Eyler - Koshi usuli');
writeln ('x=',x:5:2,'y1=',y1:9:6,'y2=',y2:9:6);
for i:=1 to m do
begin
y1:=y1+h*f(x,y); { <-----------| Eyler usuli}
for j:=1 to 2 do
k0[j]:=h*f(x+2*c[j]*h, y2+2*c[j]*k0[j-1]);
y2:=y2+(k0[1]+k0[2])/2; { <-----------| Eyler - Koshi usuli}
x:=x+h;
writeln ('x=',x:5:2,' y1=',y1:9:6,' y2=',y2:9:6);
end;
pausa;
end.
Dasturni ishga tushiramiz.
Xatolik nisbatan kattaroq, ammo natija qoniqarli.
Birinchi tartibli diffеrеnsial tеnglamalarni Eylеr usuliga turbo paskalda tuzilgan yana bir dastur
program aslon;
uses crt;
const h1=0.1;
h2=0.2;
var
x,y,z:array [0..10] of real;
i:integer;
S:real;
begin
clrscr;
x[0]:=0.3;
y[0]:=1;
for i:=0 to 5 do begin
x[i+1]:=x[i]+((i+1)*h2);
end;
for i:=0 to 5 do begin
y[i+1]:=y[i]+((sqrt(1+(sqr(x[i])+(exp(3*ln(y[i])))))*h2));
end;
for i:=0 to 5 do begin
writeln('x[',i,']=',x[i],' ','y[',i,']=',y[i]);
end;
writeln;
begin
for i:=0 to 10 do begin
x[i+1]:=x[i]+((i+1)*h1);
end;
for i:=0 to 10 do begin
y[i+1]:=y[i]+((sqrt(1+(sqr(x[i])+(exp(3*ln(y[i]))))))*h1);
end;
for i:=0 to 10 do begin
writeln('x[',i,']=',x[i],' ','y[',i,']=',y[i]);
end;
S:=((y[10]-y[5])/y[5])*100;
if S<0.001 then writeln('To`g`ri','S=',S)
else writeln('Noto`g`ri', 'S=',S);
end;
end.
Hisob grafik ishi variantlari
№
|
Tеnglama
|
Boshlang’ich qiymat
|
Kеsma
|
qadamlar
|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
|
|
7
|
|
|
|
|
8
|
|
|
|
|
9
|
|
|
|
|
10
|
|
|
|
|
11
|
|
|
|
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
|
|
15
|
|
|
|
|
16
|
|
|
|
|
17
|
|
|
|
|
18
|
|
|
|
|
19
|
|
|
|
|
20
|
|
|
|
|
21
|
|
|
|
|
22
|
|
|
|
|
23
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
|
|
26
|
|
|
|
|
27
|
|
|
|
|
28
|
|
|
|
|
29
|
|
|
|
|
30
|
|
|
|
|
Do'stlaringiz bilan baham: |