horzLine = '______________________________________________';
fprintf('\n\n            Homework #3, Problem 2 ');
fprintf('\n\n  Limit of ( root(x^2 + 1) - 1 ) / x^2 as x -> 0 \n\n');
fprintf('    x         f(x)    |     x        f(x) \n%s \n', horzLine);

for n=1:8
    x = 10^(-n);
    y = (sqrt(x^2+1) - 1) / x^2;
    % Note that f(x) is an even function of x, i.e. f(-x) = f(x)
    fprintf('%7.0e  %12.9f | %7.0e  %12.9f \n', x, y, -x, y);
end;

fprintf('%s \n\n Answer = 1/2 \n\n', horzLine);
fprintf('*** Notice the growing round-off error for |x| < 1e-4 \n\n', horzLine);
x = sym('x');
fprintf('Taylor series for root(x^2 + 1):');
pretty(taylor(sqrt(x^2+1),0,7))
