(This topic is also in Section 6.3 in Applied Calculus and Section 13.3 in Finite Mathematics and Applied Calculus)
Numerical Integration Utility  Excel Riemann Sum Grapher  
Graphing Calculator Programs  Online Text: Numerical Integration 
In the textbook we consider an example (Example 1) based in which you are given the marginal cost of making a cell phone call and need to compute the total cost of a two hour call. Instead of going over the same example here, we look at a slightly different scenario here:
The Main Example: A pump is delivering water into a tank at a rate of
First Rough Calculation: Since r(t) is the number of liters per minute at which water is entering the tank, when the pump is turned on, this rate is
Total amount pumped in  =  Number of liters/minute × Number of Minutes 
=  r(0) × 2  
=  5 × 2 = 10 liters 
Here is a graph showing that calculation we just did:
Total amount pumped in = 5 liters/minute × 2 Minutes 
Notice two things:
Referring t the second point above, the reason that we have underestimated the total amount pumped in is that we used the initial rate r(0) throughout the entire 2minute period.
Let us now redo the calculation using a minutebyminute calculation, using the rate at the start of each minute for the calculation for that minute:
Minute 1: Total amount pumped in  =  Number of liters/minute at the start of minute 1 × Number of Minutes 
=  r(0) × 1  
=  5 × 1 = 5 liters 
This gives a more accurate estimate of the total amount pumped in as
The new calculation is shown in the following graph:
Minute 1: 5 liters/minute × 1 Minute = 5 liters Minute 2: 8 liters/minute × 1 Minute = 8liters 
Notice that the new estimate is given by the sum of the areas of the two red rectangles.
But wait! This answer is still not exact: For instance, during Minute 1, the rate does not remain constant at 5 liters/minute, but is increasing there as well, and during the second minute, the rate is not constant at 8 liters/minute either. So we will next compute a more accurate third answer by using halfminute by halfminute calculations. But before we go on, let is write down what we have computed using Δt to denote the length of time we use in each step of the computation:
First Calculation (Δt = 2):  r(0)Δt = 5×2 = 10 liters 
Second Calculation (Δt = 1):  r(0)Δt + r(1)Δt = 5×1 + 8×1 = 13 liters 
Thied Calculation (Δt = 0.5):  r(0)Δt + r(0.5)Δt + r(1)Δt + r(1.5)Δt = 5×0.5 + 5.75×0.5 + 8×0.5 + 11.75×0.5 = 15.25 liters 
Each of these calculations is called a left Riemann sum of the function r(t); the first calculation is a Riemann sum with 1 subdivision, the second a Riemann sum with 2 subdivisions, and the third Riemann sum with 4 subdivisions.
Here is the graph for the third calculation:
Riemann Sum with 4 subdivisions:
r(0)Δt + r(0.5)Δt + r(1)Δt + r(1.5)Δt = 15.25 liters 
The height of the first rectangle is  r() =  
The height of the second rectangle is  r() =  
The height of the third rectangle is  r() =  
The height of the fourth rectangle is  r() =  
The height of the fifth rectangle is  r() = 
To obtain the Riemann sum, we add the areas of all five rectangles. The area of each rectangle is its height times its width Δt (0.4). Instead of multiplying each height by 0.4 and then adding, we can equivalently add the heights and multiply the sum by 0.4:
If you want to see Riemann sums graphically for different numbers of subdivisions, go to the Excel Riemann Sum Grapher, make sure that macros are enabled in Excel (If your Excel security is set to "high," macros will be automatically disabled and the utility will not work, so you will have to reset the security to "medium" through the "Tools" menu in Excel and then relaunch Excel.) Enter 3*x^2+5 in the Function box, set "a" and "b" to 0 and 2 respectively, and choose the number of subdivisions you want to use.
Riemann Sum
If f is a function defined on the interval [a, b] and n is a number (of subdivisions), we define the associated left Riemann sum with n equal subdivisions as follows:
Examples

Let us go back to thinking about the Main Example of water being pumped into a tank.
Q None of the Riemann sums we calculated for the water being pumped into the tank gave the right answer; in fact all these calculations ignore the fact that the rate keeps increasing over each interval, so Riemann sums are a waste of time, right?
A The first claim is right, but the second claim is not: Each calculation gives us a more accurate estimate of the amount of water pumped in, and in fact we have discovered an astounding fact:
We have a name for this limit of the Riemann sums or, equivalently, the area under a curve above an interval:
Definite Integral
If f is a function defined on the interval [a, b] then the definite integral of f over [a, b] is defined to be the limit of the Riemann sums as the number of subdivisions n → ∞, assuming the limit exists. We use the following notation for the definite integral:
Geometrically, the definite integral measures area. If the graph of the function is above the xaxis, the area is counted as positive (like the examples we have been looking at). If the graph of the function is below the xaxis, the area is counted as negative. The following picture illustrates the general case:
Interpretation of the Definite Integral
Examples We can sometimes calculate the definite integrqal geometrically by calculating the area under the curve directly as the following examples show:

Q What about areas that are not easy to calculate geomterically?
A The Funcdamental Theorem of Calculus (next section) tells us how to calculate these using antiderivatives. Otherwise, we can alsways use the numerical integration utility to calculate Riemann sums for larger and larger numbers of subdivisions to estimate the integral, as we will in the next example:
Q How on earth am I supposed to find the distance covered knowing only the (varying) speed?
A Think for a moment about the pump example with which we started: We discovered that:
More generally, we have (see the "Interpretation" in the above box):
In the situation we have here, the velocity v(t) is rate of change of position. So, the total change in position over the interval [2, 4] is

Since v(t) = 300 + 5t  10t^{2}, we have to compute  4 2  (300 + 5t  10t^{2}) dt,  which can do numerically using the numerical integration utility. 
To use the utility, click on the above link, enter the function 300 + 5x  10x^2 in the "f(x) = " box, enter 2 and 4 in the "Left EndPoint" and "Right EndPoint" boxes respectively, and try various values of n in the "Number of subdivisions" box. Then press "Left Sum" to get the left Riemann sum.
You now have several options