BHS Calculus logo

The Trapezoidal Rule

on the TI-89



The Trapezoidal Rule can be used to provide a more accurate approximation of the value of a definite integral than a Riemann sum, with just a little more calculation. The Trapezoidal Rule says:

trapezoidal rule

Like Riemann sums, approximating a definite integral can be tedious and error-prone, but it is easily programmed. Below is a function that calculates a Trapezoidal Rule approximation.

The syntax for the function is:

trap(expression, variable, lower limit, upper limit, number of intervals) or trap(f(x), x, a, b, n)

The easiest way to get this function is to transfer it from another calculator, or download the function and install it using TI Connect. If you need to type the function by hand, instructions are given below.

Note:

If you must type the program by hand, it is easier to enter this function using the Program Editor than the Home screen. You access the program editor by pressing the apps key key, Then select "7: Program Editor" and "3: New" from the submenu.

applications menu

In the New dialog, select "Function" from the Type menu, and type the name of the function ("trap") in the Variable field.

Now, type the function (shown at right). Some pointers:

  • Words in bold are already supplied by the program editor.
  • Press enter after each line, and the program editor will supply a ":" to start the next line.
  • It is easiest to get the keywords ("Local", "Else", etc.) from the Catalog menu.
  • If you make a mistake, just use the arrow keys to move back to it and change it.

trap(f, x, a, b, n)

: Func

: Local dx, s, c, i

: (b - a)/n sto key dx

: 0 STO> key s

: a + dx STO> key c

: For i, 1, n - 1

: s + (f | x = c) sto key s

: c + dx sto keyc

: EndFor

: Return dx* (( f | x = a) + 2*s + (f | x = b))/2

: EndFunc

The function shown at right uses the trapezoidal rule function to approximate the value of definite integral with n = 4.

trap(x^2,x,0,2,4)


last update November 26, 2007 by JL Stanbrough