### Riemann Sums Program code for the TI-81 graphing calculator

Select PRGM to get the program menu, move to EDIT to enter a program. When you select a program number, you must first give it a name (for example, 'RSUMS') to the right of the program number.
Disp "LOWER LIMIT"
Input A
Disp "UPPER LIMIT"
Input B
Disp "DIVNS"
Input N
A --> X
0 --> S
1 --> I
(B - A)/N --> H
Lbl P
S + H*Y_1 --> S
X + H --> X
IS > (I,N)
Goto P
Disp "LEFT SUM"
Disp S
S+H*Y_1 --> S
A --> X
S - H*Y_1 --> S
Disp "RIGHT SUM"
Disp S

• Take care to distinguish between the character 1 (one) and the character l (lower case "ell"), and between 0 (zero) and O (upper case "oh").
• The symbol --> is an attempt to reproduce the right-pointing arrow. This arrow is produced by hitting the STO key.
• Y_1 is intended to represent Y with the subscript 1. Y_1 is accessed via Y-VARS, i.e., 2nd VARS. (Do not use Y followed by 1, which is simply Y multiplied by 1.
• Disp and Input are accessed via PRGM, I/O, pressed while editing a program.
• The quote mark " is on the + key when you have pressed the ALPHA key.
• Lbl, IS>, and Goto are accessed via PRGM, CTL.

Running the program
• This program calculates left and right Riemann sums.
• Before running the program you need to use the GRAPH key, to specify the formula for the function f as Y_1, with X as the independent variable.
• The lower limit of integration must be less than the upper limit.
• As a test of the program, evaluate the definite integral of x^3 (x cubed) from A=1 to B=3 using N=100 subdivisions. The left and right Riemann sums should be 19.7408 and 20.2608, respectively.

Back to the Math20A homepage.
October 23, 1998