%for loop demo
clc
clear
x=0.5;
tic
series_s=0;
N=1000000;
for index=1:(N+1)
    series_s = series_s+ (x^(index-1))/(factorial(index-1));
end
e =toc
fprintf('Elapsed time = %f \n',e);
series_s
%vectorize!
tic
powers_vec = 0:N;
den_vec = factorial(powers_vec);
v_series_s=sum((x.^(powers_vec))./(den_vec));
e2 =  toc
fprintf('Vector version: Elapsed time = %f \n',e2);
v_series_s





