Riemann Sums Program code for the HP-48S and HP-48G calculators
The following is a directory for experimenting with different Riemann sums. To use a directory, press VAR to get the user's menu and then press the name of the directory on menu keys, in this case RSUM. To leave the directory when you are finished, press (left shift) UP. To create a directory, type the name, say RSUM, followed by CRDIR on the MEMORY menu.
RSUM Directory
These short programs can be entered by hand or transferred via infrared from another HP-48. Programs are given in the order you will find most convenient to use on the menu. The name of each program is given before the program. As you enter each program, store it under the given name. Thus for the first program, type << ANS - >> followed by ENTER and then type ERR and press STO.
ERR << ANS - >>
LFT << A SUM >>
RGT << A H + SUM >>
MID << A H 2 / + SUM >>
TRP << LFT B F A F - H * 2 / + >>
SMP << MID 2 * TRP + 3 / >>
NSTO << 'N' STO B A - N / 'H' STO >>
ABSTO << 'B' STO 'A' STO >>
FSTO << 'F(X)' SWAP = DEFINE >>
SUM << -> X 'H*[SIGMA](I=0, N-1, F(X+I*H))' >>
(Here [SIGMA] stands for capitol greek letter sigma, and refers to the summation subroutine.)
The other variables used by these programs will also be on your menu: A, B, F, N, H, ANS. To make sure your menu is in the most convenient order, just use FSTO, ABSTO, and NSTO once, which will create variables A, B, F, N, and H. Also, do 0 'ANS' STO to create a variable called ANS. Then press (left shift) {} and press menu buttons to get this:
{ERR LFT RGT MID TRP SMP NSTO ABSTO FSTO ANS}
Press ENTER. Then type in ORDER followed by ENTER (or find ORDER on the MEMORY menu and press the menu button).
How to use Directory RSUM
Here is an example. If you want to experiment with the integral of 1/(1 + x^2) form A=0 to B=1 with N=10 subdivisions, do this:
Enter '1/(1+X^2)' and press FSTO
Enter 0. Enter 1. Press ABSTO.
Enter 10 and press NSTO.
Now press LFT, RGT, MID, TRP, SMP to get the left, right, midpoint, trapezoidal, and Simpson approximations for the given integral. If you know the value of the integral, store that value in ANS. Then when you press ERR the value of ANS will be subtracted from from whatever is at level one of the stack. Thus, if you press MID followed by ERR, the error for the midpoint approximation will appear on the stack.
Back to the Math20A homepage.
October 23, 1998