Составить программу вычисления функции на языке паскаль (a+b)/ (e^-x+Sin(x)) T={ (a+b)/(x+1) e^-x+Sin(x) условие: x<2.8; 2.8<=x<6; x>=6 исходные данные: a=2.1; b=-0.29 шаг изменения: x принадлежит [0;7]; дельта x=0.5
function CalculateFunction(a, b, x: real): real; begin if x < 2.8 then CalculateFunction := (a + b) / ((x + 1) * exp(-x) + sin(x)) else if (x >= 2.8) and (x < 6) then CalculateFunction := (a + b) / (exp(-x) + sin(x)) else CalculateFunction := (a + b) / (exp(-x) + sin(x)); end;
begin a := 2.1; b := -0.29;
x := 0;
while x <= 7 do begin writeln('Function value at x = ', x:0:2, ' is ', CalculateFunction(a, b, x):0:2); x := x + 0.5; end; end.
program FunctionCalculation;
var
a, b, x: real;
function CalculateFunction(a, b, x: real): real;
begin
if x < 2.8 then
CalculateFunction := (a + b) / ((x + 1) * exp(-x) + sin(x))
else if (x >= 2.8) and (x < 6) then
CalculateFunction := (a + b) / (exp(-x) + sin(x))
else
CalculateFunction := (a + b) / (exp(-x) + sin(x));
end;
begin
a := 2.1;
b := -0.29;
x := 0;
while x <= 7 do
begin
writeln('Function value at x = ', x:0:2, ' is ', CalculateFunction(a, b, x):0:2);
x := x + 0.5;
end;
end.