fprintf('\n HW # 11, Problem 1: Comparison of integration methods');
fprintf('\n Intergal of cos(x^2) from 0 to pi/2\n\n');
fprintf('  N  |    Midpoing   |   Trapezoid   |   Simpsons \n');
fprintf('-----------------------------------------------------\n');

a = 0; b = pi/2;
f = inline('cos(x.^2)');

for m = 1 : 9
    N = 2 ^ m;
    IM = midpoint(a, b, f, N);
    IT = trapezoid(a, b, f, N);
    IS = simpsons(a, b, f, N);
    fprintf(' %3d | %13.9g | %13.9g | %13.9g \n', N, IM, IT, IS);
end;
    