Chekli ayirmalar usuli haqida tushunchalar


Download 332.37 Kb.
bet4/7
Sana13.04.2023
Hajmi332.37 Kb.
#1350624
1   2   3   4   5   6   7
Bog'liq
6.Maruza. Chegaraviy masalalarni chekli ayirmalar usuli yordamida yechish asoslari

{Paskal tili dasturi }
label 1;
var
y,h,a,b,t1,c,d,g,w,e,s,k:real;
n,m,i,j:integer;
x,t:array[0..60] of real;
u:array[0..60,0..60] of real;
{ f0:array[0..60,0..60] of real;}
function fnf(x:real):real;
begin fnf:=sin(3.14159*x); end;
function fnf1(t:real):real;
begin fnf1:=0 end;
function fnf2(t:real):real;
begin fnf2:=0 end;
begin
{a:=1; s:=1; t1:=0.025; h:=0.1; n:=5; m:=5;}
write(‗X argument chegaralari a,b ni kiriting=‘); readln(a,b);
write(‗X argument kesmada bo‗linishlar qadami H ni kiriting=‘); readln(H);
write(‗T argument yuqori chegarasi T1 ni kiriting=‘); readln(T1);
k:=h*h/2;
write(' t/x':6);
for i:=0 to n do
begin x[i]:=i*h; write(' ',x[i]:6:4); end;
writeln;
for j:=0 to 2*m do for i:=0 to 2*n do
begin t[j]:=j*k;
u[0,j]:=fnf1(t[j]); u[n,j]:=fnf2(t[j]);
x[i]:=i*h; u[i,0]:=fnf(x[i]);
end;
for j:=0 to 2*m do for i:=1 to 2*n do
begin
u[i,j+1]:=(u[i-1,j]+u[i+1,j])/2;
{write(' ',u[i,j+1]:6:4);}
end;
for j:=0 to m do
begin t[j]:=j*k; write(t[j]:5:4);
for i:=0 to n do
begin
write(' ',u[i,j]:6:4);
end;
writeln;
end;
readln;
end.
DASTUR-2
8 REM SAVE"xx’ar6.bas",a
10 REM DASTUR-2
12 REM parabolik TENGLAMASI UCHUN
14 REM ARALASH MASALASINI YeCHISH
16 REM
20 DIM U(60,60),X(60),T(60)
22 DEF FNF(X)=SIN(3.141593*X)
30 DEF FNF1(T)=0
40 DEF FNF2(T)=0
50 ‘READ A,B,T1,H
52 INPUT" X argument yuqori chegarasi S ni kiring="; s
54 INPUT” X argument kesmasidagi bo‘linish kadami H ni kirieing=”; h
56 INPUT” T argument yuqori chegarasi T1 ni kiring="; t1
60 K=H*H/2 : N=B/H : M=T1/K
70 FOR I=0 TO N : X(I)=I*H
80 NEXT I
90 FOR J=0 TO M : T(J)=J*K
100 U(0,J)=FNF1(T(J)) : U(N,J)=FNF2(T(J)) :NEXT J
110 FOR I=0 TO N
120 U(I,0)=FNF(X(I))
130 NEXT I
140 FOR J=0 TO M : FOR I=1 TO N-1
150 U(I,J+1)=(U(I-1,J)+4*U(I,J)+U(I+1,J))/6
160 NEXT I : NEXT J : GOSUB 220 : PRINT ": T/X ";
170 FOR I=0 TO N-5 : PRINT " :";USING "##.####";X(I);:NEXT I: PRINT " :"
180 GOSUB 220
190 FOR J=0 TO M : PRINT ": ";USING "##.###";T(J);: FOR I=0 TO N-5
200 PRINT " :";USING "##.####";U(I,J);
210 NEXT I : PRINT " :" : GOSUB 220 : NEXT J : GOTO 250
220 PRINT "-----------"; : FOR I=0 TO N-5 : PRINT "---------"; : NEXT I
230 PRINT : RETURN
240 DATA 1,1,0.025,.1
250 END
RUN
-----------------------------------------------------------------
: T/X : 0.0000 : 0.1000 : 0.2000 : 0.3000 : 0.4000 : 0.5000 :
-----------------------------------------------------------------
: 0.000 : 0.0000 : 0.3090 : 0.5878 : 0.8090 : 0.9511 : 1.0000 :
-----------------------------------------------------------------
: 0.005 : 0.0000 : 0.3040 : 0.5782 : 0.7958 : 0.9355 : 0.9837 :
-----------------------------------------------------------------
: 0.010 : 0.0000 : 0.2990 : 0.5688 : 0.7828 : 0.9203 : 0.9676 :
-----------------------------------------------------------------
: 0.015 : 0.0000 : 0.2941 : 0.5595 : 0.7701 : 0.9053 : 0.9519 :
-----------------------------------------------------------------
: 0.020 : 0.0000 : 0.2893 : 0.5504 : 0.7575 : 0.8905 : 0.9363 :
-----------------------------------------------------------------
: 0.025 : 0.0000 : 0.2846 : 0.5414 : 0.7451 : 0.8760 : 0.9210 :
-----------------------------------------------------------------
Ok_

Download 332.37 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling