Program Listings for the TI-85

Below you will find programs which enable you to calculate various Riemann sums and thereby obtain numerical approximations to integrals. The programs assume that the function you are interested in has already been stored as the variable y1 (you can do this most easily by way of the graph button).

The program LR produces both the left and the right sum for a function of your choice. You can also choose the endpoints of the subinterval and the number of subintervals. All these programs use equal partitions of the original interval. The mid point sum and trapezoidal sum are produced by the program TM. Both these programs make use of another program namely CALC. You must also enter the latter program in your calculator, but you will not need to use it directly.

Program Listing LR:

:Prompt A,B,N
:CALC
:Disp "L=",L, "R=",R

Program Listing TM:

:Prompt A,B,N
:CALC
:Disp "T=",(L+R)/2, "M=",M

Program Listing CALC:

:(B-A)/N -> H
:0 -> M
:0 -> R
:0 -> L
:A -> x
:For(k,1,N)
:y1+L -> L
:x+H -> x
:y1+R -> R
:End
:A+H/2 -> x
:For(k,1,N)
:y1+M -> M
:x+H -> x
:End
:L*H -> L
:M*H -> M
:R*H -> R
:ClLCD

In order to test the program try the following example. Enter the function f(x)=x2 as y1. Run the programs LR and TM with the inputs A=0, B=1 and N=10. You should find that the left sum is 0.285, the right sum is 0.385, the midpoint sum is 0.3325 and the trapezoidal sum is 0.335. It's a nice exercise to decide whether these are over or underestimates to the integral and why.


Send questions, comments, and suggestions to Professor Paul Goodey.

* Return to the OU home page .... * Return to the Math home page .... * Return to Paul Goodey's home page