horzLine = '__________________________________________________________';
fprintf('\n                 Homework #4, Problem 1 \n%s \n', horzLine);
fprintf('    x           f(x)              g(x)       |f(x) - g(x)| \n%s \n', horzLine);

x = 10 .^ (1:16);
f = x.^2 / 2 .* ( 1 ./ (x - 1) - 1 ./ (x + 1) );
g = x.^2 ./ (x.^2 - 1);

fprintf('%7.0e  %17.15f  %17.15f   %.1e \n', [x; f; g; abs(f-g)] );
fprintf('%s \n', horzLine);
