function sol = Hw6Num1v(a,b,N)
% sol = Hw6Num1(a,b,N)
% integrates sin(x^2) from a to b with N sub-intervals, using the the
% left-endpoint approximation.

% creates an array of x-values between a and b with N+1 points (and
% therefore N sub-intervals)
x = linspace(a,b,N+1);

% left-endpoint approximation:
% (1) x(1:end-1).^2 squares all the entries of the x-vector, up to the second
%     last, because we use the left-endpoint approximation
% (2) sin(x(1:end-1).^2) computes the sine
% (3) sum(sin(x(1:end-1).^2)) adds them together and ouputs one number
% (4) Finally, multiply the whole thing by Delta x=(b-a)/N.

sol = (b-a)/(N)*(sum(sin(x(1:end-1).^2)));
