10 DIM Y(20),X(20)
20 PRINT TAB(9);” Lagranj interpolyattsiyalash ku’xadi “
24 INPUT”(x,y) lar soni N i kiriting=”;N
30 FOR I=1 TO N : PRINT “x(“I”)=”;:INPUT X(I) : NEXT I
40 FOR I=1 TO N : PRINT “y(“I”)=”;:INPUT Y(I) : NEXT I
50 GOSUB 210 : PRINT “: X”;
60 FOR I=1 TO N :’RINT “ :”;USING”##.###”;X(I);
70 NEXT I : PRINT “ :”:GOSUB 210 :’RINT “: Y”;
80 FOR I=1 TO N :’RINT “ :”;USING”##.###”;Y(I);
90 NEXT I : PRINT “ :”:GOSUB 210
100 INPUT” x1 argumentlarlar soni N1 i kiriting=”;N1
110 FOR K=1 TO N1
120 INPUT” x1 argumentni kiriting=”;x1
130 S=0
140 FOR I=1 TO N :P=1 : FOR J=1 TO N
150 IF I=J THEN 170
160 P=P*(X1-X(J))/(X(I)-X(J))
170 NEXT J
172 S=S+P*Y(I)
174 NEXT I
180 PRINT :’RINT TAB(19);”Y(“;USING”###.###”;X1;
190 PRINT “)=”;USING”##.####”;S: NEXT K
200 END
210 PRINT “---“;: FOR I=1 TO N :’RINT “--------“;
220 NEXT I : PRINT “–“ : RETURN
230 END
(*----5.2 – Dastur--------*)
{ * Lagranj interpolyatsiya ko‘phadining qiymatini aniqlash * }
uses crt;
label 20;
var
i,j,n:integer;
k,z,’:real;
x,y:array[1..7] of real;
begin
clrscr;
writeln(‘ Lagranj interpolyatsiya ko‘phadining qiymatini aniqlash ‘);
write(‘(x,y)-juftliklar soni N= ‘); readln(n);
for i:=1 to n do
begin
gotoxy(i*10,3);
write(‘x(‘,i,’)=’);read(x[i]);
gotoxy(i*10,4);
write(‘y(‘,i,’)=’);read(y[i]);
end;
writeln(‘berilgan argument qiymati:’);
write(‘x=’);readln(z);
k:=0;
for j:=0 to n do begin ‘:=1;
Do'stlaringiz bilan baham: |