program Interpolasi_Kuadrat;
uses wincrt;
var
i, j, k : integer;
a, b, fx1x2, fx2x3, fx1x2x3 : real;
x, y : array[1..100] of real;
label 1, 2, 3;
Begin
1:
for i:= 1 to 3 do
begin
writeln('Koordinat P',i,'(x',i,', y',i,')');
write(' x',i,' = ');readln(x[i]);
write(' y',i,' = ');readln(y[i]);
end;
writeln;
write('Nilai x dari titik yang dicari: ');readln(a);
fx1x2:= (y[2] - y[1])/(x[2] - x[1]);
fx2x3:= (y[3] - y[2])/(x[3] - x[2]);
fx1x2x3:= (fx2x3 - fx1x2)/(x[3] - x[1]);
b:= y[1] + (a - x[1])*(fx1x2) + (a - x[1])*(a - x[2])*(fx1x2x3);
writeln;
writeln('Jadi titik yang dicari adalah Q(',a:0:4,', ',b:0:4,')');
Tidak ada komentar:
Posting Komentar