% quessingLimitsPitfall.m % examine lim x->0 f(x) % first try to quess by evaluating f(x) at x closer and closer to x=0 format long x = [1e-2 1e-4 1e-6 1e-8 1e-10 1e-12 1e-14]' f = (tan(x) - x)./x.^3 disp('it seems that f -> 0 as x ->0') % What happened. Loss of Significat Digits. Look at the values % of the numerator and denominator separately. At x=0.001 we have % 0.0000000003/0.000000001 = 1/3. At x=0.00000001 % we have 0/(1.0 x 10^(-18)) = 0. pause % press any key to continue disp('but graphically this does not seem to be the case, the limit seems to be 1/3') x = linspace(-1,1,200); f = (tan(x) - x)./x.^3; plot(x,f) pause disp(' ') disp('let Matlab evaluate the limit with its symbolic toolbox') syms x % make x a symbolic variable limit((tan(x) - x)./x.^3,x,0) format