PUT INTAPP.82p TI82 program to display Riemann sums. Function, bounds, number of variables, type of sum can all be customized. ----begin documentation---- This program is designed to demonstrate the various ways of doing a Riemann summ. It is useful in teaching the concept of the definite integral. The program asks the user to supply a function which is then stored in Y1. The user is also asked for upper and lower bounds, number of subintervals, and the method of sum desired. The program computes a convenient window for graphing, then draws the function along with the approximating rectangles and computes the sum. It should be noted that the program uses the min and max functions to set the upper and lower bounds for the y range. Since these functions use a seed to find a local min and max, functions with a local min or max in the designated x range may continue off the screen. When running the program, the user is reminded that on the TI-82, inputing a function through a program requires that the function start with a double quote mark. The function is stored in Y1. The program uses the variables: U, L, and N are the upper and lower limits of X, and the number of subintervals respectively. H and S are the width of a subinterval and the Riemann sum. M is the midpoint of a subinterval. I and Z are counters and dummy variables. The program puts the calculator in function mode and turns off the graphing of variables other than Y1. This program is joint work of Paul Patterson and Mike May from the Department of Mathematics and Computer Science at Saint Louis University. Send comments to: maymk@slu.edu ----end documentation---- ----begin ASCII---- \START82\ \COMMENT=Program file dated 01/24/96, 16:54 \NAME=INTAPPX \FILE=INTAPPX.82p Func FnOff Disp "ENTER FUNCTION" Disp "DON'T FORGET THE" Disp "QUOTES BEFORE" Disp "THE FUNCTION" Input \Y1\ Disp "ENTER LOWER LIMIT" Prompt L Disp "ENTER UPPER LIMIT" Prompt U L\->\Xmin U\->\Xmax min(0,\Y1\(fMin(\Y1\,X,L,U)))\->\Ymin max(0,\Y1\(fMax(\Y1\,X,L,U)))\->\Ymax Ymax-Ymin\->\H (H/54)*6+Ymax\->\Ymax \(-)\(H/54)*2+Ymin\->\Ymin max(1,iPart ((U-L)/10))\->\Xscl max(1,iPart (H/10))\->\Yscl Disp "X TIC, Y TIC",Xscl,Yscl Disp "Y MIN, Y MAX",Ymin,Ymax Disp "HIT ENTER" Pause 1\->\Z Repeat Z=0 ClrDraw Lbl X Disp "NUMBER OF SUB" Disp "INTERVALS" Prompt N If N\>=\1 Goto Y Disp "NEED \>=\ 1" Goto X Lbl Y Menu("TYPE APPROX","MINIMUM",A,"MAXIMUM",B,"LEFT SUM",C,"RIGHT SUM",D,"\#\ MIDPOINT",F,"TRAPZOID",G) Lbl A (U-L)/N\->\\@\ 0\->\S For(I,0,N-1,1) fMin(\Y1\,X,L+(I*\@\),L+(I+1)*\@\)\->\M S+\@\*\Y1\(M)\->\S Line(L+I*\@\,0,L+I*\@\,\Y1\(M)) Line(L+I*\@\,\Y1\(M),L+(I+1)*\@\,\Y1\(M)) Line(L+(I+1)*\@\,0,L+(I+1)*\@\,\Y1\(M)) End Text(0,2,"AREA=",S) Pause Goto E Lbl B (U-L)/N\->\\@\ 0\->\S For(I,0,N-1,1) fMax(\Y1\,X,L+(I*\@\),L+(I+1)*\@\)\->\M S+\@\*\Y1\(M)\->\S Line(L+I*\@\,0,L+I*\@\,\Y1\(M)) Line(L+I*\@\,\Y1\(M),L+(I+1)*\@\,\Y1\(M)) Line(L+(I+1)*\@\,0,L+(I+1)*\@\,\Y1\(M)) End Text(0,2,"AREA=",S) Pause Goto E Lbl C (U-L)/N\->\\@\ 0\->\S For(I,0,N-1,1) \Y1\(L+I*\@\)\->\M S+\@\*M\->\S Line(L+I*\@\,0,L+I*\@\,M) Line(L+I*\@\,M,L+(I+1)*\@\,M) Line(L+(I+1)*\@\,0,L+(I+1)*\@\,M) End Text(0,2,"AREA=",S) Pause Goto E Lbl D (U-L)/N\->\\@\ 0\->\S For(I,0,N-1,1) \Y1\(L+(I+1)*\@\)\->\M S+\@\*M\->\S Line(L+I*\@\,0,L+I*\@\,M) Line(L+I*\@\,M,L+(I+1)*\@\,M) Line(L+(I+1)*\@\,0,L+(I+1)*\@\,M) End Text(0,2,"AREA=",S) Pause Goto E Lbl F (U-L)/N\->\\@\ 0\->\S For(I,0,N-1,1) \Y1\(L+(I+.5)*\@\)\->\M S+\@\*M\->\S Line(L+I*\@\,0,L+I*\@\,M) Line(L+I*\@\,M,L+(I+1)*\@\,M) Line(L+(I+1)*\@\,0,L+(I+1)*\@\,M) End Text(0,2,"AREA=",S) Pause Goto E Lbl G (U-L)/N\->\\@\ 0\->\S For(I,0,N-1,1) .5(\Y1\(L+I*\@\)+\Y1\(L+(I+1)*\@\))\->\M S+\@\*M\->\S Line(L+I*\@\,0,L+I*\@\,\Y1\(L+I*\@\)) Line(L+I*\@\,\Y1\(L+I*\@\),L+(I+1)*\@\,\Y1\(L+(I+1)*\@\)) Line(L+(I+1)*\@\,0,L+(I+1)*\@\,\Y1\(L+(I+1)*\@\)) End Text(0,2,"AREA=",S) Pause Goto E Lbl E Disp "ANOTHER APPROX?" Disp "0 FOR NO,1 YES" Prompt Z End \STOP82\ ----end ASCII---- ----begin UUE---- begin 664 INTAPPX.82p M*BI423@R*BH:"@!0*E1( M12E&54Y#5$E/3BH_W%X0/]XJ14Y415(I3$]715(I3$E-250J/]U,/]XJ14Y4 M15(I55!015(I3$E-250J/]U5/TP$8PH_501C"S\:,"M>$!`G7A`K6"M,*U41 M$1$$8PP_&3`K7A`0*%X0*U@K3"M5$1$1!&,-/V,-<6,,!$@_$$B#-301@C9P M8PT$8PT_L!!(@S4T$8(R<&,,!&,,/QDQ*[D0$%5Q3!&#,3`1$01C`C\9,2NY M$$B#,3`1$01C`S_>*E@I5$E#*RE9*51)0RHK8P(K8P,_WBI9*4U)3BLI62E- M05@J*V,,*V,-/]XJ2$E4*45.5$52*C_8/S$$6C_26FHP/X4_UE@_WBI.54U" M15(I3T8I4U5"*C_>*DE.5$525D%,4RH_W4X_SDYN,3_763_>*DY%140I;BDQ M*C_76#_663_F*E194$4I05!04D]8*BLJ34E.24U532HK02LJ34%824U532HK M0BLJ3$5&5"E354TJ*T,K*E))1TA4*5-532HK1"LJ34E$4$])3E0J*T8K*E12 M05!:3TE$*BM'$3_603\057%,$8-.!%L_,`13/]-)*S`K3G$Q*S$1/R=>$"M8 M*TQP$$F"6Q$K3'`027`Q$8);$01-/U-P6X)>$!!-$013/YQ,<$F"6RLP*TQP M28);*UX0$$T1$3^<3'!)@ELK7A`031$K3'`027`Q$8);*UX0$$T1$3^<3'`0 M27`Q$8);*S`K3'`027`Q$8);*UX0$$T1$3_4/Y,P*S(K*D%214%J*BM3$3_8 M/]=%/]9"/Q!5<4P1@TX$6S\P!%,_TTDK,"M.<3$K,1$_*%X0*U@K3'`028); M$2M,$!!-$2M,$!!,<$F"6Q$$33]3<%N"3013 M/YQ,<$F"6RLP*TQP28);*TT1/YQ,<$F"6RM-*TQP$$EP,1&"6RM-$3^<3'`0 M27`Q$8);*S`K3'`027`Q$8);*TT1/]0_DS`K,BLJ05)%06HJ*U,1/]@_UT4_ MUD0_$%5Q3!@1;/S`$4S_322LP*TYQ,2LQ$3]>$!!,$!!,<$F"6Q%P7A`03'`027`Q$8);$1$$33]3<%N"3013/YQ,<$F"6RLP M*TQP28);*UX0$$QP28);$1$_G$QP28);*UX0$$QP28);$2M,$!!,*C`I1D]2*4Y/*S$I6453*C_=6C_49J@` end ----end UUE---- eof (end of file)