% Clear the screen and display a header
clc
fprintf('     x      x - sin(x)      x - sin(x)     Error     Error\n');
fprintf('             (Exact)       (Improved)       Abs.      Rel.\n');
fprintf('===============================================================\n');

for i=1:10
	x = 10^-i;

	% Exact comparison
	exact = double(sym(10^-i)-sin(sym(10^-i)));

	% Improved version
	n=1:9;
	improved=sum(((-1).^(n+1) .* x.^(2*n+1)) ./ factorial(2*n+1));

	% Calculate relative and absolute errors
	abserror = abs(improved-exact);
	relerror = abserror / exact;

	fprintf(' %7.0e   %7.6e   %7.6e  %7.3e  %7.3e\n', x, exact, improved, abserror, relerror);
end