Graphing Calculator Programs

Calculus Applied to the Real World
Numerical Integration:
Trapezoid and Simpson Approximations

              Text on Numerical Integration
Index of On-Line Topics
Return to Main Page
Everything for Calculus
Utility: Numerical Integration Utility

Graphing Calculator Program to Compute Left- and Right-Hand Riemann Sums and Trapezoid Rule (TI-83)

:Input ("N? ",N) Prompts for the number of rectangles
:Input ("LEFT ENDPOINT? ",A) Prompts for the left end-point a
:Input ("RIGHT ENDPOINT? ",B) Prompts for the right end-point b
:(B-A)/ND D is x = (b-a)/n
: 0R Set R to 0 (zero); it will eventually be the right-hand sum
: 0L Set L to 0 (zero); it will eventually be the left-hand sum
:AX X is the current x-coordinate
:For (I,1,N) Start of a loop-recall the sigma notation
:L+Y1L Increment L by the by f(xi-1)
:A+I*DX Corresponds to our formula xi = a + ix
:R+Y1R Increment R by f(xi)
:End End of loop
:L*DL Left sum
:R*DR Right sum
:(L+R)/2T Trapezoidal sum
:Disp "LEFT SUM IS ",L
:Disp "TRAP SUM IS ",T

Graphing Calculator Program for Simpson's Rule (TI-83)

:Input ("EVEN NUMBER N2? ",N) Make sure that N is even and at least 2
:Input ("LEFT ENDPOINT? ",A)
:0S Set S to 0 (zero)
:For (I,1,N-1,2) The loop increments I in by 2 each time
:S+Y1S The next four steps compute the sum
:A+I*DX f(xi-1) + 4f(xi) + f(xi+1)
:S+4* Y1S
:S*D/3S Multiply by x/3

Using the Programs

First enter the function f(x) whose sums you wish to compute as Y1 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.