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.
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 key, Then select "7: Program Editor" and "3: New" from the submenu. |
|
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:
|
trap(f, x, a, b, n) : Func : Local dx, s, c, i : (b - a)/n dx : 0 s : a + dx c : For i, 1, n - 1 : s + (f | x = c) s : c + dx c : 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 with n = 4. |
|