LEFT-HAND SUM PROGRAM

WITH EXTENSION TO RIGHT-HAND SUMS AND THE TRAPEZOID RULE

Texas Instruments TI-82 and TI-83

This program inputs A,B,N and evaluates the left-hand sum on [A,B], with N equal subdivisions, of the function f(X) stored as an expression in location Y1.

General: To type an upper case letter, press ALPHA key, followed by the letter. To begin entering the program, press the PGRM key, and select NEW from the menu. The calculator will go into ALPHA mode and prompt you to enter the name. Type in (for example) LEFTSUM and press ENTER. The program now displays a colon : which must appear at the beginning of each command.
To enter the program commands (all the words in the program that start with a Capital Letter), press PRGM key, then select one of the two menus:

• CTL (Control commands)
• I/O (Imput-output commands).
Select the command you need from the appropriate menu. After typing each command, press the ENTER key. (You may also stay on the same line by typing a colon : (ALPHA .)
```
Commands:			Remarks and keying instructions:

:Prompt A,B,N                   Program asks for A, B and N. Prompt
is 2 on the I/O menu.
:A->X				For ->, press STO key.  For X, Press the
[X,T,theta] key. This command sets the
variable X equal to the input A.
:0->S				0 is zero! (S will be the running total
of the  sum)
:1->I				I counts the number of steps taken
:(B-A)/N->H			- is the key to the right of the 6 key.
For /, press the division key,
which is under the ^ key.
:Lbl P                          This spot in the program is labelled P.
with the PRGM key.
:S+Y1*H->S			For Y1 (the value of the function you are
summing, at the current X) press Y-VARS
(2nd VARS), select Function, select Y1,
ENTER. For *, press the multiplication
key, which is to the right of the 9 key.
:X+H->X                         Update X.
:IS>(I,N)			IS>( is on the CTL menu. The comma is the
key below SIN. This command ("Increment
and Skip on test") adds 1 to I. If the
new I-value is greater than N, the next
instruction in the program is skipped.
(So if I+1>N, i.e. I is greater than or
equal to N, program skips to Disp
"LSUM",S; other-wise it recycles to the
Lbl P command.)
:Goto P
:Disp "LSUM",S			" is ALPHA +
```
Ending: After pressing the ENTER key for the last command, press the QUIT (2nd MODE) key.

Running the program: First you have to type in the expression for the function you want to sum. Press the Y= key (under screen) and enter your function as Y1. Use the [X,T,theta] key for your variable. As a test, put in x-cubed, i.e. [X,T,theta], then ^, then 3, then ENTER. Then press QUIT. Now to run the sum, press PRGM, select EXEC, and select LEFTSUM (It is selected automatically if it is the only program you have.) The screen will display a prompt pgrmLEFTSUM. press ENTER. Enter the A, B, N you want at the question mark (?) prompts.

Some trouble shooting: When typing in the program, be sure to use the STO key as above , and not the equality (=) key!!

Check: For Y1=f(x)=x^3, lower limit 1, upper limit 3, and N = 100, left-hand sum should be 19.7408.

Exercise: Rewrite this program to give right-hand sums.

RIGHT HAND SUMS AND THE TRAPEZOID RULE

Add these instructions to the end of the program:

```
:A->X				For ->,X,Y1,*,Disp," follow the keying
:S-Y1*H->R			instructions above.
:B->X
:R+Y1*H->R
:Disp "RSUM",R
:(S+R)/2->T
:Disp "TRAP",T
```

Check: For Y1=f(X)=sin X, lower limit 0, upper limit pi/2, and N = 10, LSUM = .91940317, RSUM = 1.076482803, TRAP = .9979429864.

Anthony Phillips
Math Dept SUNY Stony Brook
tony@math.sunysb.edu
September 8 1997