
01.12.2011, 14:48
|
Продвинутый
|
|
Регистрация: 13.02.2006
Адрес: Магнитогорск
Сообщения: 669
Репутация: 14745
|
|
Код:
const n = 8;
function f(x : real) : real;
begin
result := -21 / sqr(6 - 7 * x);
end;
function integrate(a, b: real; n: integer): real;
var
i: integer;
res, h, x: real;
begin
res := 0;
h := (b - a) / n;
for i := 1 to n - 1 do begin
x := a + i * h;
res := res + f(x);
end;
Result := h * ((f(a) + f(b)) / 2 + res);
end;
var
c: real;
begin
c := integrate(-2, 0, 8);
writeln('Значение: ', c);
end.
|