Algoritmlash va tadbiqiy dasturlash


Download 277.64 Kb.
bet6/6
Sana15.03.2023
Hajmi277.64 Kb.
#1268658
1   2   3   4   5   6
Bog'liq
Algoritmlash va tadbiqiy dasturlash ” fanidan

for i:=0 to n-1 do
begin
if i=j then goto 20;
:=‘*(z-x[i])/(x[j]-x[i]);
20: end;
k:=k+y[j]*’;
end;
writeln(‘Ko‘phadning qiymati:’);
writeln(‘y(‘,z:2:1,’)=’,k:4:2);
readln;
end.
Lagranj interpolyatsiya ko‘phadining qiymatini aniqlash
(x,y)-juftliklar soni N=6
x(1)=0.05 y(1)=0.050042
x(2)=0.1 y(2)=0.100335
x(3)=0.17 y(3)=0.171657
x(4)=0.25 y(4)=0.255342
x(5)=0.3 y(5)=0.309336
x(6)=0.39 y(6)=0.376403
berilgan argument qiymati: x=0.263
Ko‘phadning qiymati:y(0.3)=0.27
Berilgan jadval asosida tuziladigan Lagranj interpolyatsiya ko‘phadi yordamidami bilan berilgan argument qiymatida funksiya qiymatini hisoblash va interpolyatsiya ko‘phadining grafigini qurish dasturini beramiz:
5’------------ 5.3- Dastur ----------------------
10 CLS:SCREEN 9
20 LINE(0,137)-(600,137),3
30 LINE(250,0)-(250,600),5
40 REM SAVE”lagr23-g”,a
50 PRINT TAB(9);”BERILGAN JADVALGA ASOSAN LAGRANJ INTERPOLYaTSIYa”
52 PRINT TAB(19); “KO‘PHADINI HISOBLASH VA GRAFIGINI QURISH”
60 READ N
70 FOR I=1 TO N :READ X(I),Y(I) : NEXT I
80 FOR I=1 TO N
90 PSET(X(I)*40+250,-Y(I)*40*.64+136),5
100 NEXT I
110 PRINT “ : X”;” : Y :”
120 FOR I=1 TO N :’RINT “ :”;USING”##.###”;X(I);
130 PRINT “ :”;USING”##.###”;Y(I)
140 NEXT I
150 FOR X1=X(1) TO X(N) STEP .01
160 S=0
170 FOR I=1 TO N :P=1 : FOR J=1 TO N
180 IF I=J THEN 200
190 P=P*(X1-X(J))/(X(I)-X(J))
200 NEXT J
210 S=S+’*Y(I)
220 NEXT I
230 Y1=S:FOR R=1 TO 10000 :NEXT R
240 PSET(X1*40+250,-Y1*40*.64+136),3
250 NEXT X1
260 DATA 10
270 DATA 2,0.6931,3.0,1.0986,4.0,1.3863,5.0,1.8094,5.6,1.94
280 DATA 5.9,6.17,7.68,17.43,8.6,9.12,9.8,18.5,11.5,12.8
290 END
Download 277.64 Kb.

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




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