Ренат
4 год назад
Протабулировать функцию в паскалеУсловия: (сумма) S=1+3x^/1!+5x^4/2!+....(диапазон изменений [0,1;1]n=10 (функция) y=(1+2x^2)*e^x^2
ОТВЕТЫ
Иванка
Oct 24, 2020
const e=0.001;
var x,xn,h,an,s,f,y:real; n,k,i:integer;
begin
n:=10;
h:=(1-0.1)/(n-1);
x:=0.1-h;
for i:=1 to n do
begin
x:=x+h; an:=1;
xn:=1; f:=1;
k:=0; s:=1;
while an>e do
begin
xn:=xn*x*x;
k:=k+1;
f:=f*k;
an:=(2*k+1)*xn/f;
s:=s+an;
end;
y:=(1+2*x*x)*exp(x*x);
writeln('x = ',x:4:1,' s = ',s:6:4,' y = ',y:6:4);
end;
end.
Результат:
x =0.1 s = 1.0303 y = 1.0303
x =0.2 s = 1.1241 y = 1.1241
x =0.3 s = 1.2911 y = 1.2911
x =0.4 s = 1.5490 y = 1.5490
x =0.5 s = 1.9260 y = 1.9260
x =0.6 s = 2.4653 y = 2.4653
x =0.7 s = 3.2320 y = 3.2320
x =0.8 s = 4.3240 y = 4.3240
x =0.9 s = 5.8894 y = 5.8895
x =1.0 s = 8.1548 y = 8.1548
var x,xn,h,an,s,f,y:real; n,k,i:integer;
begin
n:=10;
h:=(1-0.1)/(n-1);
x:=0.1-h;
for i:=1 to n do
begin
x:=x+h; an:=1;
xn:=1; f:=1;
k:=0; s:=1;
while an>e do
begin
xn:=xn*x*x;
k:=k+1;
f:=f*k;
an:=(2*k+1)*xn/f;
s:=s+an;
end;
y:=(1+2*x*x)*exp(x*x);
writeln('x = ',x:4:1,' s = ',s:6:4,' y = ',y:6:4);
end;
end.
Результат:
x =0.1 s = 1.0303 y = 1.0303
x =0.2 s = 1.1241 y = 1.1241
x =0.3 s = 1.2911 y = 1.2911
x =0.4 s = 1.5490 y = 1.5490
x =0.5 s = 1.9260 y = 1.9260
x =0.6 s = 2.4653 y = 2.4653
x =0.7 s = 3.2320 y = 3.2320
x =0.8 s = 4.3240 y = 4.3240
x =0.9 s = 5.8894 y = 5.8895
x =1.0 s = 8.1548 y = 8.1548
352
Смежные вопросы: