Description:
Simple exercise that calculate the Taylor expansion of the exponential
function.
Input variables: degree N
vector of evaluation points, x
At each step plots the Taylor polynomial and compare with the real
function
function y=taylor_exp(N,x)
printf("Order of the expansion: d ", N)
size(x)
y=ones(size(x))
plot(x,y,"r-",x,exp(x),"b-")
legend("n=0,exp(x)")
for n=1:N
y+=(1/factorial(n))*(x.^n)
plot(x,y,"r-",x,exp(x),"b-")
xlabel("x")
ylabel("f(x)")
legend("approx","exp(x)")
pause
end
endfunction
To Search:
File list (Check if you may need any files):
chis_rnd.m
GAMM_RND.M
HPDI.M
is_scalar.m
MOMENTG.M
NORM_CDF.M
norm_pdf.m
norm_rnd.m
STDN_CDF.M
stdn_pdf.m
tdens.m
tdis_rnd.m
truncnorm_rnd.m