LEFT RIGHT SUMS - HP 48

Introduction
This program computes left and right hand approximations for  $\int\limits_a^bf(x)dx$. It also includes the average of the approximations.
 
If you have not used one of the programs posted on this website before, you should read through the information in the Intro to Programming section first.


The Program
Note: The main program, LRSUM, will call a subprogram, SUMM. Both programs are given below.

<<"N" ":N:" INPUT
OBJ 'N' STO
"A" ":A:" INPUT
OBJ 'A' STO
"B" ":B:" INPUT
OBJ 'B' STO
0 'SUM' STO
B A  -  N  /  'H'  STO
A 'X' STO
FUNC EVAL 'D' STO
SUMM SUM 'L'  STO
N H*A + 'X' STO
FUNC EVAL SUM + 'R' STO
R D - 'R' STO
L H * 'L' STO
R H * 'R' STO
L R  +  2  /  'T' STO
"ESTIMATES"
L "LEFT" TAG
R "RIGHT" TAG
T "AVG" TAG
{A B N H L R T D X SUM}
PURGE >>
ENTER 'LRSUM' STO {This stores the program under variable name LRSUM.}
<<1 N FOR C FUNC
EVAL SUM + 'SUM' STO X
H + NUM 'X'
STO NEXT >>
ENTER 'SUMM' STO


Running the Program
 
You will need to enter a function f(x) into a variable called FUNC before running the program. Follow the instructions in