PUT INTAPPX.85p TI85 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. The function is stored in Y10 after being input through EQ. 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 , LC, T, T1, T2, theta, I, and Z are dummy variables used at various points of the program. 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---- \START\ \COMMENT=Program file dated 12/26/95, 13:27 \NAME=INTAPPX \FILE=INTAPPX.85p Func FnOff InpST "ENTER FUNCTION",EQ \St>Eq\(EQ,y10) Disp "ENTER LOWER LIMIT" Prompt L Disp "ENTER UPPER LIMIT" Prompt U L\->\xMin U\->\xMax min(0,evalF(y10,x,(fMin(y10,x,L,U)))\->\yMin max(0,evalF(y10,x,fMax(y10,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 ClDrw Lbl X Disp "NUMBER OF SUB" Disp "INTERVALS" Prompt N If N\>=\1 Goto Y Disp "NEED \>=\ 1" Goto X Lbl Y Disp "TYPE APPROX" Menu(2,"MAX",B,3,"LEFT",C,4,"RIGHT",D,5,"MidPt",F,1,"Trpzd",G) Lbl B (U-L)/N\->\\LC-theta\ 0\->\S For(I,0,N-1,1) fMax(y10,x,L+(I*\LC-theta\),L+(I+1)*\LC-theta\)\->\M evalF(y10,x,M)\->\T S+\LC-theta\*T\->\S Line(L+I*\LC-theta\,0,L+I*\LC-theta\,T) Line(L+I*\LC-theta\,T,L+(I+1)*\LC-theta\,T) Line(L+(I+1)*\LC-theta\,0,L+(I+1)*\LC-theta\,T) End Pause Disp "AREA=",S Pause Goto E Lbl C (U-L)/N\->\\LC-theta\ 0\->\S For(I,0,N-1,1) evalF(y10,x,(L+I*\LC-theta\))\->\M S+\LC-theta\*M\->\S Line(L+I*\LC-theta\,0,L+I*\LC-theta\,M) Line(L+I*\LC-theta\,M,L+(I+1)*\LC-theta\,M) Line(L+(I+1)*\LC-theta\,0,L+(I+1)*\LC-theta\,M) End Pause Disp "AREA=",S Pause Goto E Lbl D (U-L)/N\->\\LC-theta\ 0\->\S For(I,0,N-1,1) evalF(y10,x,(L+(I+1)*\LC-theta\))\->\M S+\LC-theta\*M\->\S Line(L+I*\LC-theta\,0,L+I*\LC-theta\,M) Line(L+I*\LC-theta\,M,L+(I+1)*\LC-theta\,M) Line(L+(I+1)*\LC-theta\,0,L+(I+1)*\LC-theta\,M) End Pause Disp "AREA=",S Pause Goto E Lbl F (U-L)/N\->\\LC-theta\ 0\->\S For(I,0,N-1,1) evalF(y10,x,(L+(I+.5)*\LC-theta\))\->\M S+\LC-theta\*M\->\S Line(L+I*\LC-theta\,0,L+I*\LC-theta\,M) Line(L+I*\LC-theta\,M,L+(I+1)*\LC-theta\,M) Line(L+(I+1)*\LC-theta\,0,L+(I+1)*\LC-theta\,M) End Pause Disp "AREA=",S Pause Goto E Lbl G (U-L)/N\->\\LC-theta\ 0\->\S For(I,0,N-1,1) evalF(y10,x,L+I*\LC-theta\)\->\T1 evalF(y10,x,L+(I+1)*\LC-theta\)\->\T2 .5*(T1+T2)\->\M S+\LC-theta\*M\->\S Line(L+I*\LC-theta\,0,L+I*\LC-theta\,T1) Line(L+I*\LC-theta\,T1,L+(I+1)*\LC-theta\,T2) Line(L+(I+1)*\LC-theta\,0,L+(I+1)*\LC-theta\,T2) End Pause Disp "AREA=",S Pause Goto E Lbl E Disp "ANOTHER APPROX?" Disp "0 FOR NO,1 YES" Prompt Z End FnOff \STOP\ ----end ASCII---- ----begin UUE---- begin 664 INTAPPX.85p M*BI423@U*BH:#`!03$P+S(!>"\0*!`[`WDQ,"\R`7@O,TPO,U41$1$+/09O$Q!$,``O)1`[ M`WDQ,"\R`7@O*1`[`WDQ,"\R`7@O,TPO,U41$1$+/0=O/0=A/08+,TAO$#-( M<40U-``1<$0V`&`]!PL]!V^A$#-(<40U-``1<$0R`&`]!@L]!F\3$$0Q`"^C M$!`S56$S3!%Q1#$P`!$1"ST";Q,01#$`+Z,0,TAQ1#$P`!$1"ST#;^DM6"!4 M24,L(%D@5$E#`"\]`B\]`V_I+5D@34E.+"!9($U!6``O/08O/0=OZ2U(250@ M14Y415(`;^)O1#$`"S-:;]PS6E!$,`!O@V_@6`!OZ2U.54U"15(@3T8@4U5" M`&_I+4E.5$525D%,4P!OYS-.;]@S3E1$,0!OX0&O60!OZ2U.145$(!D@,0!O MX0%I6`!OX%D`;^DM5%E012!!4%!23U@`;TP01#(`+RU-05@`+S-"+T0S`"\M M3$5&5``O,T,O1#0`+RU224=(5``O,T0O1#4`+RU-:610=``O,T8O1#$`+RU4 M3$P+S(!>"\S31$+,U1O,U-@,@'!<#-4"S-3;Y80 M,TQ@,TEP,@'!+T0P`"\S3&`S27`R`<$O,U01;Y80,TQ@,TEP,@'!+S-4+S-, M8!`S26!$,0`1<#(!P2\S5!%OEA`S3&`0,TE@1#$`$7`R`<$O1#``+S-,8!`S M26!$,0`1<#(!P2\S5!%OWF_B;^DM05)%03T`+S-3;^)OX0:Z10!OX$,`;Q`S M56$S3!%Q,TX+,@'!;T0P``LS4V_=$#-)+T0P`"\S3F%$,0`O1#$`$6\E$#L# M>3$P+S(!>"\0,TQ@,TEP,@'!$1$+,T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