33 PRINT “ Y1=F(X,Y) uchun”
34 PRINT “Koshi masalani RUNGE – KUTTA usulida”
36 PRINT “ taqribiy yechimini topish”
38 PRINT
40 N=(B-X)/H
42 FOR I=1 TO N
43 Q1=H*FNE(X,Y)
44 Q2=H*FNE(X+H/2,Y+Q1/2)
45 Q3=H*FNE(X+H/2,Y+Q2/2)
46 Q4=H*FNE(X+H,Y+Q3)
47 Y=Y+(Q1+2Q2+2Q3+Q4)/6
49 X=X+H
50 PRINT “X (“;USING “###.###”;I:
52 PRINT “)=”;USING “###.###”;X;
54 PRINT “ F(“;USING “###.###”;I;
56 PRINT “)=”;USING “###.###”;Y
59 NEXT I
90 END
Birinchi tartibli differentsial tenglama
Y1=F(X,Y) uchun
Koshi masalasini RUNGE – KUTTA usulida
taqribiy yechimini topish.
X(1)=1.900 Y(1)=2.8201
X(2)= 2.000 Y(2)= 3.0408
X(3)= 2.100 Y(3)= 3.2619
X(4)= 2.200 Y(4)= 3.4831
X(5)= 2.300 Y(5)= 3.7045
X(6)= 2.400 Y(6)= 3.9260
X(7)= 2.500 Y(7)= 4.1478
X(1)= 2.600 Y(1)= 4.3700
X(9)= 2.700 Y(9)= 4.5931
X(90)= 2.800 Y(90)= 4.8172
9.4- Paskal tili dasturi
{Birinchi tartibli differentsial tenglama }
{Y'=F(X,Y) uchun}
{Koshi masalasini Runge-Kutta usulida}
{taqribiy yechimini topish}
uses crt;
function f(x,y:real):real;
begin
f:=x+y
end;
var
x,y,q1,q2,q3,q4,b,h:real;
i,n:integer;
begin
clrscr;
writeln(' Koshi masalasini Runge-Kutta usulida hisoblash');
x:=0;y:=1;n:=10;b:=2;
h:=(b-x)/n;
for i:=1 to n do
BEGIN
q1:=h*f(x,y);
q2:=h*f(x+h/2,y+q1/2);
q3:=h*f(x+h/2,y+q2/2);
q4:=h*f(x+h,y+q3);
y:=y+(q1+2*q2+2*q3+q4)/6;
Do'stlaringiz bilan baham: |