TI-85 Program:
Numerical Approximation of Definite Integrals


This is a program for the TI-85 which will approximate a definite integral using left, right, and midpoint Riemann sums, the trapezoid method, and Simpson's rule. For partition length n, these numerical approximations are respectively denoted by Ln, Rn, Mn, Tn, and Sn.

To use the program, one must input a formula for the integrand F(x), values for the lower and upper limits of integration a and b, and the desired partition length n. The output will be the numerical approximations Ln, Rn, Mn, Tn and Sn. To exit the program use the ON key (at the lower left corner of the TI-85 keyboard).

:Disp" "
:Disp"Approximating a" 
:Disp"definite integral"
:Disp" "
:InpSt "F(x)= ",FCN
:St>Eq(FCN,F)
:Input "a= ",A
:Input "b= ",B
:ClLCD
:
:Lbl NEWn
:Input "n= ",N
:(B-A)/N->H
:0->L
:0->R
:0->M
:0->T
:0->S
:0->YP
:evalF(F,x,A)->Y
:1->JS
:
:For(J,1,N,1)
: YP->YPP
: Y->YP
: evalF(F,x,A+J*H)->Y
: evalF(F,x,A+(J-.5)*H)->YM
:
: L+YP*H->L
: R+Y*H->R
: M+YM*H->M
: T+(YP+Y)*H/2->T
: L+YP*H->L
: If JS==0
:  Then
:   S+(YPP+4*YP+Y)*H/3->S
:   1->JS
:  Else
:   0->JS
: End
:End
:
:Disp "Ln,Rn,Mn,Tn,Sn= ",L,R,S,M,T,S
:Pause
:Goto NEWn

To understand how this code works, note that L, R, M, T, and S respectively denote Ln, Rn, Mn, Tn, and Sn. Also J denotes the variable of summation; H is the length of the subintervals in the partition; Y and YP are the functional values of the right and left endpoints of the Jth subinterval respectively ; and YPP is the functional value of the left endpoint of the (J-1)st subinterval.

[In the code as typed above, the symbols "St>Eq(" and "evalF(" can be found on the TI-85's CATALOG menu. The symbol "->" is obtained using the "STO>" key which is the second key from the lefthand bottom of the calculator. Many of the other command words can be found on the I/O and CTL menus which are available when editing programs. The greater than and less than symbols may be found on the TEST menu.]




This document was created on November 18, 1998 and revised on
Nov. 24.

Your questions, comments or suggestions are welcomed. Please direct correspondence to:

Andy Miller
Department of Mathematics
University of Oklahoma
e-mail: amiller@ou.edu

URL: http://www.math.ou.edu/~amiller/ti85/appint.htm