Graphing Calculator Programs

Text on Numerical Integration
Index of OnLine Topics Return to Main Page Everything for Calculus Utility: Numerical Integration Utility 
Graphing Calculator Program to Compute Left and RightHand Riemann Sums and Trapezoid Rule (TI83)
PROGRAM: TRAP  
:Input ("N? ",N)  Prompts for the number of rectangles 
:Input ("LEFT ENDPOINT? ",A)  Prompts for the left endpoint a 
:Input ("RIGHT ENDPOINT? ",B)  Prompts for the right endpoint b 
:(BA)/ND  D is x = (ba)/n 
: 0R  Set R to 0 (zero); it will eventually be the righthand sum 
: 0L  Set L to 0 (zero); it will eventually be the lefthand sum 
:AX  X is the current xcoordinate 
:For (I,1,N)  Start of a looprecall the sigma notation 
:L+Y_{1}L  Increment L by the by f(x_{i1}) 
:A+I*DX  Corresponds to our formula xi = a + ix 
:R+Y_{1}R  Increment R by f(x_{i}) 
:End  End of loop 
:L*DL  Left sum 
:R*DR  Right sum 
:(L+R)/2T  Trapezoidal sum 
:Disp "LEFT SUM IS ",L  
:Disp "RIGHT SUM IS ",R  
:Disp "TRAP SUM IS ",T  
:Stop 
Graphing Calculator Program for Simpson's Rule (TI83)
PROGRAM: SIMP  
:Input ("EVEN NUMBER N³2? ",N)  Make sure that N is even and at least 2 
:Input ("LEFT ENDPOINT? ",A)  
:Input ("RIGHT ENDPOINT? ",B)  
:(BA)/ND  
:0S  Set S to 0 (zero) 
:AX  
:For (I,1,N1,2)  The loop increments I in by 2 each time 
:S+Y_{1}S  The next four steps compute the sum 
:A+I*DX  f(x_{i1}) + 4f(x_{i}) + f(x_{i+1}) 
:S+4* Y_{1}S  
:X+DX  
:S+Y_{1}S  
:End  
:S*D/3S  Multiply by x/3 
:Disp "SIMPSON SUM IS ",S  
:Stop 
Using the Programs
First enter the function f(x) whose sums you wish to compute as Y_{1} in the "Y=" window. Then run the program. It will first ask for N, which is the number of partitions you wish to use. Enter the number (which must be at least 1) and then press ENTER. (If you are running SIMP, make sure that the number you enter is even.) Next, it will ask for the values of A and B in that order, so you enter them in the same way. Then wait a while (the larger N is, the longer the wait), and the answers will appear.