ALLSUMS - HP 48

Introduction
This program computes left, right, Trapezoid, Midpoint, and Simpson's approximations for  $\int\limits_a^bf(x)dx$.
 
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, ASUM, 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
SUMM SUM 'L' STO
0 'SUM' STO
A H+'X' STO SUMM
SUM 'R' STO
0 'SUM' STO
A H 2  /  +  'X' STO
SUMM SUM 'M' STO
L H  *  'L' STO
R H  *  'R' STO
M H  *  'M' STO
L R  +  2  /  'T' STO
2 3  /  M  *  T 3  /  +   'S' STO
L "LHAND" TAG
R "RHAND" TAG
M "MIDPT" TAG
T "TRAP" TAG
S "SIMPSON" TAG
{A B N H L R T M S X SUM}
PURGE>>
ENTER 'ASUM' STO {This stores the program under variable name ASUM.}
<<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