Programs to compute Riemann sums on the TI-83 Plus

Remark: this is a short program to do elementary stuff, written after a
few minutes of reading the manual. It appears to work, but I claim no
"expertise" in programming this or any other calculator. Similar
commands (or more efficient ones) probably exist on other calculators of this type,
but you will have to read- the-friendly- manual yourself.

The program below prompts the user for  A,B,N, and computes the left-endpoint
Riemann sum on the interval [A,B], divided into N subintervals, for the function
stored in
y1. (Notation: in the description below, --> denotes the STO-> key.)


: Prompt A,B,N
(the Prompt command is found in the PRGM/ I/O menu.)
: seq (A+(I-1)(B-A)/N, I, 1, N) --> L1
(seq is found in the LIST/OPS menu; this command line generates the
list of  N left endpoints in [A,B] and stores this list in L1)
: sum (((B-A)/N)Y1(L1))--> L
(sum is found in the LIST/MATH menu; this command line computes
the Riemann sum and stores the result in L- this is just a matter of applying
the function y1 to the sequence L1, multiplying the result by (B-A)/N, and adding up
the resulting sequence.)
: Disp "LEFT SUM IS", L
(Disp is found in PRGM/ I/O)
: fnInt(Y1,X,A,B)--> F
(this computes the `exact' value of the integral- only a more efficient approximation, really-
and stores it in F. fnInt is the 9th entry in the MATH/MATH menu.)
: Disp "INT IS", F
: (F-L)/F--> E
(This computes the relative error of the N-interval approximation, compared
to the `exact' value given by the calculator)
: Disp "REL ERROR IS", E

To run the program, go to PRGM/EXEC and choose SUMLEFT.

Exercise: write similar programs SUMRIGHT and SUMMID to compute the right-endpoint
and midpoint Riemann sums with N intervals. Only the second command line needs to be changed,
: seq (A+I (B-A)/N, I, 1, N)--> L2
: seq (A+(I-1/2)(B-A)/N, I, 1, N)-->L3
respectively. Of course, I am also storing the lists in L2 and L3 now, so
the sum command should be changed accordingly. And I would store the Riemann sums to
R and M, respectively (instead of L); the program line defining the relative error should be changed

When you test your programs with simple functions, you will quickly notice that
in most cases SUMMID has a much smaller relative error (for the same N). N=100 is
a reasonable value to start testing.


To program SUMTRAP, the following changes are needed:
1)  :seq (A+I(B-A)/N,I,0,N)--> L4  (this is the list register L4, above the 4 key)
2)  : ((B-A)/N)(sum(Y1(L4))-(Y1(A)+Y1(B))/2)-->T (this is the Y1 in VARS/Y-VARS/Function and the same L4 as above)
(You should convince yourself that is the same as the formula in the book.)
4) Further down,  change the program line defining the relative error to:
: (F-T)/F-->E