function v = RIEMANN(f,a,b,n)
%This computes the Riemann sum for the function f(x) on
%the interval [a,b] using the left hand endpoints with n
%rectangles.
%To run this m-file, you need to first define the function you want to
%find the Reimann sum of.  For example, if you want to find the 
%left hand Riemann sum of f = x^3 from [1,3] using 10 rectangles
%you would enter the following sequence of commands into the Command Window
%f = inline('x^3');
%RIEMANN(f,1,3,10)

v = 0;%initialize our riemann sum to 0
deltax = (b - a)/n;%define delta x
for k = 1:n
    c = a + (k-1)*deltax;%compute the left-hand endpoints
    v = v + f(c);%add up the function values at the left endpoints
end
v = deltax*v;%compute the Riemann summ