Riemann Sums Program code for the CASIO fx-7700GB (or CASIO cfx-9850G Plus) calculator
To enter the program, press MODE then 2 to select WRT mode. Move the cursor to an empty program number, then press EXE. You'll see a blank screen with the blinking cursor at the upper left corner. Now you can proceed to the beginning of the program. When finished, press MODE then 1 to get back to RUN mode.
"RSUMS"
"L-LIM"? --> A
"R-LIM"? --> B
"DIVNS"? --> N
A --> X
0 --> S
f_1 --> Y
(B-A) div N --> H
Lbl 1
X + H --> X
f_1 + S --> S
Dsz N
Goto 1
"L-SUM="
(S-f_1+Y)H
[display sign]
"R-SUM="
HS
Comments on the program listing
- 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").
- "?" is accessed by SHIFT, PRGM.
- "f_1" is accessed by SHIFT, F (in a box) MEM, f_n, 1
- "Lbl", "Dsz", and "Goto" are in JMP menu.
- You can put either a colon ( : ) or a carriage return (EXE) after each instruction (to separate them), except after the display sign, which provides its own carriage return.
Running the program
- This program calculates left and right Riemann sums.
- The formula for the integrand (function to be integrated) must be entered into f_1 using X as the indpendet 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