### Riemann Sums Program code for the TI-85 (or TI-86) graphing calculator

Select PRGM to get the program menu, then select EDIT to enter a program. When you enter a program, you must first give it a name (for example, 'RSUMS'). To finish editing, hit EXIT.
Disp "LOWER LIMIT"
Input A
Disp "UPPER LIMIT"
Input B
Disp "DIVNS"
Input N
A --> x
0 --> S
0 --> T
1 --> I
(B - A)/N --> H
Lbl P
S + y1*H --> S
x + H/2 --> x
T + y1*H --> T
x + H/2 --> x
IS > (I,N)
Goto P
Disp "LEFT SUM"
Disp S
S+H*y1 --> S
A --> x
S - y1*H --> S
Disp "RIGHT SUM"
Disp S
Disp "MIDPOINT SUM"
Disp T

• 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.
• Disp, ", and Input are accessed via I/O, pressed while in the middle of the program.
• Use the x-Var key for x.
• Lbl, IS>, and Goto are accessed via CTL or CATALOG.
• y1 is typed by entering 2nd ALPHA Y and then 1.

Running the program
• This program calculates left and right Riemann sums. It also calculates Riemann sums based on midpoints.
• Before running the program you need to use the GRAPH key, to specify the formula for the function f as y1.
• 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