Taylor series for e^x with loop
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
How would I solve this problem and only compute the first 12 interations?
Réponses (1)
Lateef Adewale Kareem
le 19 Juil 2022
%% 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)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!