Цитата
Ln^2|x-2|+sqrt(x+3) , x<=2
y=
E^(6-2x)+2cos^3(x-3), x>2
y=
E^(6-2x)+2cos^3(x-3), x>2
на отрезке [1,3] c шагом 0.2
чето я совсем запутался.
Function F1(x:double):double;
begin
f1:=sqr(ln(abs(x-2)))+sqrt(x+3);
end;
Function F2(x:double):double;
begin
f2:=exp(6-2*x)+2*sqr(cos(x-3))*cos(x-3);
end;
Const
a:double = 1;
b:double = 3;
step:double = 0.1;
eps:double = 0.00001;
var
x,r:double;
begin
x:=a;
while abs (b-x)>eps do begin
if x<=2 then r:=f1(x) else r:=f2(x);
writeln(x:10, r:10);
x:=x+step
end;
readln
end.
Const
a:double = 1;
b:double = 3;
step:double = 0.1;
eps:double = 0.00001;
var
x,r:double;
begin
x:=a;
while abs (b-x)>eps do begin
if x<=2 then r:=sqr(ln(abs(x-2)))+sqrt(x+3)
else r:=exp(6-2*x)+2*sqr(cos(x-3))*cos(x-3);
writeln(x:10, r:10);
x:=x+step
end;
readln
end.
program labwork2_2;
uses crt;
const
step:double=0.2;
a:double=1;
b:double=3;
eps:double=0.00001;
var
x,y:double;
BEGIN
x:=a;
while abs(b-x)>eps do
begin
if x<=2 then y:=sqr(ln(abs(x-2)))+sqrt(x+3);
if x>2 then y:=Exp(6-2*x)+2*sqr(cos(x-3))*cos(x-3);
writeln(x:10,y:10);
x:=x+step;
readln;
readkey;
END.
{$N+}