The following is in the Hewlett Packard ASCII format used by hp link and other hp datainterchange programs. There are four issues that you should be aware of if you areattempting to type this program into your calculator 'by hand':
THIS PROGRAM HAS NOT BEEN PLACED IN THE PUBLIC DOMAIN. IN UNALTERED FORM, IT CAN BE USED FOR ANY NON-COMMERCIAL EDUCATIONAL PURPOSE. THECODE GIVEN BELOW SHOULD NOT BE MODIFIED IN ANY WAY WITHOUT THEWRITTEN PERMISSION OF THE AUTHOR. IF YOU USE ANY PART OF THE CODE OR ANY OF THEIDEAS WORKED OUT WITHIN IT, THE COPYRIGHT NOTICE INCLUDED IN THIS PROGRAM MUSTBE DISPLAYED AT YOUR PROGRAM'S STARTUP.
%%HP: T(3)A(R)F(.);\<< CLLCD"HP 48G: Riemann Sums" 2 DISP@" Copyright (c) 1996" 4 DISP" by Jack Courtney" 5 DISP" All Rights Reserved" 6 DISP\-> x a b n \<< x INDEP STEQ b a - n / \-> h \<< a b XRNG 'a+I*h' 'I' 0 n 1 SEQ @ Generate a list of the x-values DUP 1 \<< RCEQ x ROT 2 \->LIST | \->NUM \>> DOLIST @ and of the function values DUP TAIL \GSLIST h * @ Calculate the RH sum SWAP REVLIST TAIL \GSLIST h * @ Calculate the LH sum SWAP DUP2 + 2 / @ Trapezoidal sum (TR)=(RH+LH)/2 "Trapezoidal Sum" \->TAG ROT "Left Hand Sum" \->TAG ROT "Right Hand Sum" \->TAG ROT 4 ROLL DUP TAIL SWAP REVLIST TAIL REVLIST ADD 2 / @ Generate a list of the x-values at the midpoints 1 \<< RCEQ 'PPAR' 3 GET ROT 2 \->LIST | \->NUM \>> DOLIST @ and of the function values \GSLIST h * DUP @ Calculate the midpoint sum (MP) "Mid Point Sum" \->TAG SWAP 2 * 3 PICK DTAG + 3 / @ Simpson's sum = (2*MP+TR)/3 "Simpson's Sum" \->TAG \>> \>>\>>
Click here to download an electronic copy. (To load this directly into your calculator, you will need hplink hardware and hplink or hpcomm software or an equivalent.)