Taylor series for e^x with loop
4 次查看(过去 30 天)
显示 更早的评论

How would I solve this problem and only compute the first 12 interations?
6 个评论
回答(1 个)
Lateef Adewale Kareem
2022-7-19
%% This is more efficient
x = 2;
v = 1;
n = 1;
d = 1;
for i = 1:20
n = n*x;
d = d*i;
v = v + n/d;
end
fprintf('Computed Value: %f', v)
1 个评论
另请参阅
类别
Find more on General Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!