please help with this question
显示 更早的评论
Consider the following Matlab code, which was written to reproduce a telescoping series
Mo=-1;
Mn=0;
n=1;
while (Mn-Mo)>0.00001
Mo=Mn;
Mn=Mn+1/n*(n+1);
n=n+1;
end
The code, as it appears above, does not yield the desired result. Identify what is wrong with the code, correct it, and report the resulting sum to four significant figures
回答(1 个)
KSSV
2020-8-14
n = 10000 ;
thesum = 0 ;
for i = 1:n
thesum = thesum+1/(n*(n+1)) ;
end
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!