TI-82 PROGRAM: SIMPSON'S RULE & TRAPEZOIDAL RULE


(press ENTER at end of line)

KEY IN DISPLAY EXPLANATION
PRGM -> -> ENTER SIMPSONPrgm 1: SIMPSONProgram named "SIMPSON"
2nd VARS 5 2FnOffDeselects all functions
Disp 2nd "LOWERLIMIT"Disp "LOWERLIMIT"Lower limit of integration
Input AInput AAfter ?, type in the lower limit of integration
Disp 2nd "UPPERLIMIT"Disp "UPPERLIMIT"Upper limit of integration
Input BInput BAfter ?, type in the upper limit of integration
Disp 2nd "N SUBINTERVALS" Disp "N SUBINTERVALS" Number of subintervals for [A, B] is N
Disp 2nd "ENTER EVEN N"Disp "ENTER EVEN N" The even integer N is to be entered
Input N Input NAfter ?, type in N
0 STO S -> S0 is stored in location S (for Simpson's Rule)
0 STO V -> V0 is stored in location V (for the Trapezoidal Rule)
(B - A) (N) STO W(B - A)/N -> WSubinterval width (B-A)/N stored in location W
1 STO J1 -> J1 is stored in location J
Lbl 1Lbl 1Start of loop
A + 2(J - 1)W STO LA + 2(J - 1)W -> LLeft endpoint of [A+2(j-1)W, A+2jW] stored in L
A + 2JW STO RA + 2JW -> RRight endpoint of [A+2(j-1)W, A+2jW] stored in R
(L + R) 2 STO M(L + R)/2 -> MMidpoint of [A+2(j-1)W, A+2jW] stored in M
L STO X,T,L -> XL is stored in location X
2nd VARS 1 1 STO LY1 -> LY1(L) is stored in location L
M STO X,T,M -> XM is stored in location X
2nd VARS 1 1 STO MY1 -> MY1(M) is stored in location M
R STO X,T,R -> XR is stored in location X
2nd VARS 1 1 STO RY1 -> RY1(R) is stored in location R
W(L+4M+R) 3 + S STO S W(L+4M+R)/3 + S -> S New sum is stored in location S (for Simp. Rule)
W(L+2M+R) 2 + V STO V W(L+2M+R)/2 +V -> V New sum is stored in location V (for Trap. Rule)
IS > J , N/2)IS > (J,N/2)Increment J one step. If J>N/2, skip next command
Goto 1Goto 1Program returns to Lbl 1 and loops again
Disp 2nd "Simpson Rule"Disp. "Simpson Rule"Prepares for the Simpson's Rule approximation
Disp SDisp SDisplays the Simpson's Rule approximation S
Disp 2nd "Trap. Rule"Disp. "Trap. Rule"Prepares for the Trapezoidal Rule approximation
Disp VDisp VDisplays the Trapezoidal Rule approximation V


To execute the program in order to evaluate do the following:

2nd QUIT (to quit the program)

Y=  key in your function f(x)  ENTER
2nd QUIT
PRGM  (choose the program) ENTER
The display reads LOWERLIMIT, ? Key in A ENTER(gives the lower limit of integration)
The display reads UPPERLIMIT, ? Key in B ENTER (gives the upper limit of integration)
The display reads ... ENTER N, ? Key in N ENTER (gives number of interval into which [A, B] is divided)
The display then exhibits the Simpson Rule and Trapezoidal Rule approximations for the value of the integral. Note that with this program, the number of subintervals for each rule is even.

To execute the program again, just key in ENTER

Identification of italicized words in the program:
Input(PRGM -> 1)
Display(PRGM -> 3)
Label(PRGM -> 9)
Goto(PRGM )
Is >(PRGM aA)

represents zero (distinguished from the letter 0)
If you type then you get a "space" (between two words)