deff('y=f(x)', 'y=cos(sin(x^-1))');

h = 0.1;
x = zeros(1,11);
y = zeros(1,11);

for i=0:10
	x(i+1) = 0.5 + i*h;
	y(i+1) = f(x(i+1)); 
end

deff('y=P(x)', 'y = 7.2934442 - (33.541345*x) + (41.006888*x^2) +(91.606835*x^3) - (395.9602*x^4) + (662.91941*x^5) - (653.69626*x^6) + (408.66852*x^7) - (160.09795*x^8) + (36.03501*x^9) - (3.5679901*x^10)');
E = zeros(3,11);
for j=0:9
	E(1,j+1) = abs(f(0.55+j*h) - P(0.55+j*h));
	E(2,j+1) = E(1,j+1) / abs(f(0.55+j*h));
	E(3,j+1) = 100*E(2,j+1);
	printf("E_abs(%.2f)=%f, E_rel(%.2f)=%f, E_por(%.2f)=%f\n", 0.55+j*h, E(1,j+1), 0.55+j*h, E(2,j+1), 0.55+j*h, E(3,j+1));
end