Back to Lab Intro Back to Tutorials Next

Tutorial: Trapezoidal Rule

The trapezoidal rule approximates the integral of some function f over some interval. Recall that the formula for the trapezoidal rule is the following:

(h/2)[f(x0) + 2f(x1) + 2f(x2) + ... +2f(xn-1) + f(xn)]

where h is the width of the subinterval (that is, the width divided by the number of subintervals n), and the x0, x1, etc., are the points at the beginning and end of each subinterval.

To carry out the trapezoidal rule in Excel, do the following:

Step 1: Choose n and calculate the width

Pick the number of subintervals, and compute the width of each subinterval. To approximate the integral of f from a to b with n subintervals, your width is h = (b-a)/n. Then enter a column with x values and a column with y values for your function. The x values should be in increments of h (see Filling Down in the Excel Tutorial for help with filling these in.)

For our example, we will approximate the integral of f(x) = x2 on the interval from 2 to 8, with n = 5. Thus h = (8-2)/5 = 1.2 is our step size, and we will next set up an x column in increments of 1.2.

 

Back to Lab Intro Back to Tutorials Next