MAC 2311/2312 Honors Calculus: Riemann sums on TI-83
Riemann Sums
The goal here is to have TI-83 compute the various Riemann sums (left, right, midpoint) that approach the definite integral of a given function f(t) on the interval [a,b].
For each sum, one needs to specify the number of subintervals, n, and the type of the sum -- left, right, or midpoint -- depending on where the function is to be evaluated on each subinterval of length
h=(b-a)/n.
For example, the Left Riemann Sum with n=10 subintervals for f(t) on [a,b] is
S = h [f(a) + f(a+h) + ... + f(a+9h)].
Analogously, the Right Riemann Sum is
S = h [f(a+h) + f(a+2h) + ... + f(a+10h)],
and the Midpoint Riemann Sum is
S = h [f(a+0.5h) + f(a+1.5h) + ... + f(a+9.5h)],.
As an example, take
f(x)=x2 on the interval [2, 4] with n=10 subintervals
of length h = (4 - 2)/10 = 0.2.
TI-83 Basics
If you have a different model, follow the instructions below,
but enter the appropriate commands/buttons for your model
(find and read its manual first).
Here are two ways to easily compute these Riemann integral sums on your TI-83 graphing calculator: as a sum of a list and as a programmed loop. Keep in mind that:
- you define the function Y1 (enter its formula) in the Equations Editor Y= (upper left button);
- you refer to the list L2 by typing 2nd 2;
- you refer to the function Y1 by typing
VARS Y-VARS 1;
- you refer to variables by typing the green ALPHA key (example: to refer to the variable N, type ALPHA LOG);
- you assign values to variables using the STO button (lower left), (example: to store 4 in B, type 4 STO ALPHA MATRX -- this is noted below as 4 sto B).
- The function seq() is in the List Ops menu.
- The function sum() is in the List Math menu.
- The commands For() and End are in the Prgm Ctl menu.
For more information, read the
TI-83 Guidebook (PDF 4MB)
or browse
the list of guidebooks for TI graphing calculators.
Sum of a List
The idea is simple: generate the list of the function values for the appropriate sum, compute its sum, and multiply it by h=(b-a)/n. For example, to compute the Left Sum for
f(x)=x2 on the interval [2, 4] with 10 subintervals
do the following:
- Compute the list of the values of x2 for the left-ends of all subintervals by typing (recall that Seq is in the List Ops menu):
seq(X2, X, 2, 3.8, 0.2) sto L2
-
Compute the sum of these values and multiply it by the common factor h=(b-a)/n=(4-2)/10=0.2
(recall that Sum is in the List Math menu):
0.2 * sum (L2)
You should get 17.48 as a result.
- Now compute the right sum by changing the input in part 1 (use the Entry button) to
seq(X2, X, 2.2, 4, 0.2) sto L2
and repeating step 2 (use Entry again); you should get 19.88.
For more information, read
Chapter 11 (Lists) of the
TI-83 Guidebook.
The idea is to create a short (7 lines) program to compute the sum automatically (in a loop) after you provide a formula for Y1 and values for a, b, n, and v (the type of the sum: v = 0 for Left, v = 1 for Right, and v = 0.5 for Midpoint).
- Press Prgm New 1: Create New.
- Name your program RIEM.
(If you already have a program with that name, use a different name.)
- Enter the following lines in the program,
pressing ENTER after each line.
(Press PRGM 4 to get "For";
press PRGM 7 to get "End".)
: 0 sto S
: (B - A) / N sto H
: For(K,1,N)
: A + (K-1+V) * H sto X
: S + Y1 sto S
: End
: H * S
-
Test your program to compute the Left Riemann Sum for the function f(x)=x2 on the interval [2, 4] with 10 subintervals:
- Now compute the Right Sum by letting V=1 (type 1 sto V and repeat the step above). You should get 19.88 as a result; store it in R for later use.
- Which sum is larger: Left or Right? Why?
- The Trapezoid Sum is the average of the Left and Right Riemann Sums. Compute (L + R) / 2; you should get 18.68 as a result; store it in T.
- Now compute the Midpoint Sum by letting V=0.5; you should get 18.66 as a result. Store it in M.
- Of course, the exact integral is
(43 - 23)/3 = 18 + 2/3 = 18.6667. Store it in E.
Compute the error of each method by subtracting the exact value E from L, R, T, or M.
- Compare the errors M-E and T-E. What do you notice? Which method is "more precise" here -- Midpoint or Trapezoid? How much "more precise"?
- The Simpson rule computes (2 M + T) / 3,
which is a weighted average of M and T with weights 2/3 and 1/3.
Compute it and compare it to the exact integral. Yes, they are the same -- Simpson's rule gives the exact answer for quadratic functions.
- Experiment with larger N. How large should N be if you want precision (the difference between the Right and the Left Sum) of 0.001?
See 5.1 in the Calculus textbook.
- Compute all four sums (Left, Right, Trapezoid, and Simpson)
and their errors (difference from the exact integral)
for N = 20, 40, 100, and 200.
Describe the pattern as N gets larger:
what happens to the errors in each case?
Based on the pattern,
make a conjecture about the error in each case for N=1000.
Verify it (be patient; it takes a long time for TI-83 to compute sums for N=1000).
- Test your program on a different function of your choice
(do not pick linear or quadratic functions).
- Pick reasonable values for A and B and compute the exact integral.
- Pick N and repeat steps 4-13 above for the function of your choice.
Is the Simpson rule exact this time?
You can now use the RIEM programm in other situations: other functions (redefine Y1), other intervals (redefine A and B), other number of subintervals (redefine N), other types of sums (redefine V).
For more information, read
Chapter 16 (Programming) of the TI-83 Guidebook.
The "Exact" Integral
Recall that you can have TI-83 compute definite integrals with higher precision (the result that TI-83 returns is still not exact, but more sophisticated methods are used to achieve the high precision). To compute this "exact" value, just define and plot the function (with appropriate window parameters) and select Calc (top row) Int f(x)dx.
This value is TI-83's approximation to the limit of the Riemann sums.
Course home |
Syllabus |
Current Assignments |
Previous Assignments
Last updated on
Friday, September 7, 2007 at 14:39
by
Eugene Belogay