% this is a test program for the integral from a to b of cos(x) f'(x)
% area = goof(a,b,n)

function area = goof(a,b,n)

h = (b-a)/(n-1);
for i=1:n
  x(i) = a + (i-1)*h;
end

area = 0;
for i=1:n-1
  area = area + cos(x(i))*d_right(x(i),h)/2 + cos(x(i+1))*d_right(x(i+1),h)/2;
%  area = area + cos(x(i))*d_mid(x(i),h)/2 + cos(x(i+1))*d_mid(x(i+1),h)/2;
end
area = area*h;